@clue-ai/cli 0.0.21 → 0.0.22
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/package.json +1 -1
- package/src/setup-agent.mjs +35 -2
package/package.json
CHANGED
package/src/setup-agent.mjs
CHANGED
|
@@ -329,6 +329,35 @@ const attemptFailureContext = ({ attempt, error, setupCheck, stage }) => ({
|
|
|
329
329
|
failed_checks: failedChecks(setupCheck),
|
|
330
330
|
});
|
|
331
331
|
|
|
332
|
+
const summarizeFailedChecks = (checks) => {
|
|
333
|
+
if (!Array.isArray(checks) || checks.length === 0) return null;
|
|
334
|
+
return checks
|
|
335
|
+
.map((check) => {
|
|
336
|
+
const missingApis = Array.isArray(check.details?.missing_apis)
|
|
337
|
+
? check.details.missing_apis.filter(Boolean)
|
|
338
|
+
: [];
|
|
339
|
+
const parts = [
|
|
340
|
+
check.id,
|
|
341
|
+
check.summary,
|
|
342
|
+
missingApis.length ? `missing APIs: ${missingApis.join(", ")}` : null,
|
|
343
|
+
].filter(Boolean);
|
|
344
|
+
return parts.join(" - ");
|
|
345
|
+
})
|
|
346
|
+
.join("; ");
|
|
347
|
+
};
|
|
348
|
+
|
|
349
|
+
const summarizeAttemptFailure = (failureContext) => {
|
|
350
|
+
if (!failureContext) return "no attempt details were recorded";
|
|
351
|
+
if (failureContext.error) {
|
|
352
|
+
return `attempt ${failureContext.attempt} ${failureContext.stage} failed: ${failureContext.error}`;
|
|
353
|
+
}
|
|
354
|
+
const failedCheckSummary = summarizeFailedChecks(failureContext.failed_checks);
|
|
355
|
+
if (failedCheckSummary) {
|
|
356
|
+
return `attempt ${failureContext.attempt} setup-check failed: ${failedCheckSummary}`;
|
|
357
|
+
}
|
|
358
|
+
return `attempt ${failureContext.attempt} failed without detailed error output`;
|
|
359
|
+
};
|
|
360
|
+
|
|
332
361
|
export const runSetupAgent = async ({
|
|
333
362
|
env = process.env,
|
|
334
363
|
flags = new Map(),
|
|
@@ -490,8 +519,12 @@ export const runSetupAgent = async ({
|
|
|
490
519
|
},
|
|
491
520
|
blockers: [
|
|
492
521
|
{
|
|
493
|
-
reason:
|
|
494
|
-
evidence:
|
|
522
|
+
reason: summarizeAttemptFailure(failureContext),
|
|
523
|
+
evidence: {
|
|
524
|
+
...failureContext,
|
|
525
|
+
retry_budget_exhausted: true,
|
|
526
|
+
max_attempts: maxAttempts,
|
|
527
|
+
},
|
|
495
528
|
},
|
|
496
529
|
],
|
|
497
530
|
user_verification: {
|