agents-relay 2.0.121 → 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/adapters.js +13 -2
- package/dist/planner.js +3 -2
- package/package.json +1 -1
package/dist/adapters.js
CHANGED
|
@@ -195,8 +195,19 @@ function rawBrowserWorkspaceCommand(cli, args, stdin, signal) {
|
|
|
195
195
|
resolve(stdout.trim());
|
|
196
196
|
else if (signal?.aborted)
|
|
197
197
|
reject(new Error('browser-worker execution aborted'));
|
|
198
|
-
else
|
|
199
|
-
|
|
198
|
+
else {
|
|
199
|
+
// Browser Workspace reports a compact code/message JSON on nonzero exit.
|
|
200
|
+
// Preserve existing Relay failure behavior; only simplify the error text.
|
|
201
|
+
let reason = stderr.trim() || stdout.trim() || `browser-workspace exited ${code}`;
|
|
202
|
+
try {
|
|
203
|
+
const envelope = parseWorkspaceJson(stdout);
|
|
204
|
+
const result = envelope.result;
|
|
205
|
+
if (result?.ok === false && typeof result.code === 'string' && typeof result.message === 'string')
|
|
206
|
+
reason = `${result.code}: ${result.message}`;
|
|
207
|
+
}
|
|
208
|
+
catch { /* Preserve legacy error handling for other CLI failures. */ }
|
|
209
|
+
reject(new Error(reason));
|
|
210
|
+
}
|
|
200
211
|
});
|
|
201
212
|
if (signal?.aborted)
|
|
202
213
|
abort();
|
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)}`);
|