mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-10-23 17:33:51 +02:00
Automatically import skills from new GitHub project repositories and update enabled sources in the background. Preserve project-derived access, saved selections, immutable execution versions and explicit pins; add legacy adoption, refresh and connection repair in Sources. Include durable scheduling and bounded work credits, production Storybook journeys, real GitHub-to-routine acceptance receipts and final-head CI/security/Greptile qualification. Co-Authored-By: Paperclip <noreply@paperclip.ing>
10 lines
620 B
TypeScript
10 lines
620 B
TypeScript
/** Share retry scheduling between initial imports and subsequent refreshes. */
|
|
export function skillSourceRetryAt(error: unknown, failureCount: number, now = new Date()) {
|
|
const backoff = Math.min(60 * 60_000, 5 * 60_000 * 2 ** Math.min(failureCount, 4));
|
|
const providerDelay = error instanceof Error && 'details' in error
|
|
? (error.details as { retryAfterMs?: unknown } | null)?.retryAfterMs : undefined;
|
|
const delay = typeof providerDelay === 'number' && Number.isFinite(providerDelay)
|
|
? Math.max(backoff, Math.min(24 * 60 * 60_000, providerDelay)) : backoff;
|
|
return new Date(now.getTime() + delay);
|
|
}
|