(ms: number)
| 549 | } |
| 550 | |
| 551 | function formatMilliseconds(ms: number): string { |
| 552 | const seconds = Math.floor(ms / 1000) |
| 553 | const minutes = Math.floor(seconds / 60) |
| 554 | const hours = Math.floor(minutes / 60) |
| 555 | const days = Math.floor(hours / 24) |
| 556 | |
| 557 | if (days > 0) { |
| 558 | return `${days}d ${hours % 24}h` |
| 559 | } |
| 560 | if (hours > 0) { |
| 561 | return `${hours}h ${minutes % 60}m` |
| 562 | } |
| 563 | if (minutes > 0) { |
| 564 | return `${minutes}m ${seconds % 60}s` |
| 565 | } |
| 566 | return `${seconds}s` |
| 567 | } |
| 568 | |
| 569 | async function ensureAnthropicAccessToken(auth: Extract<Auth.Info, { type: "oauth" }>, providerID: string): Promise<string> { |
| 570 | let token = auth.access |
no outgoing calls
no test coverage detected