File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -63,9 +63,10 @@ export const OPENCODE_GO_MODEL_IDS: readonly string[] = OPENCODE_GO_MODELS.map(
6363
6464export const OPENCODE_GO_DEFAULT_MODEL : GoModelId = "kimi-k2.7-code" ;
6565
66- export const PROTOCOL_BY_ID = new Map < string , GoProtocol > (
67- OPENCODE_GO_MODELS . map ( ( m ) => [ m . id , m . protocol ] ) ,
68- ) ;
66+ export const PROTOCOL_BY_ID : ReadonlyMap < string , GoProtocol > = new Map <
67+ string ,
68+ GoProtocol
69+ > ( OPENCODE_GO_MODELS . map ( ( m ) => [ m . id , m . protocol ] ) ) ;
6970
7071export function protocolForGoModel ( modelId : string ) : GoProtocol | undefined {
7172 return PROTOCOL_BY_ID . get ( modelId ) ;
Original file line number Diff line number Diff line change @@ -99,7 +99,7 @@ export async function fetchGoUsage(
9999 }
100100}
101101
102- function formatUsagePercent ( w : GoUsageWindow ) : string {
102+ function formatWindowUsage ( w : GoUsageWindow ) : string {
103103 if ( w . usagePercent !== undefined ) return `${ Math . round ( w . usagePercent ) } %` ;
104104 if ( w . usageDollars !== undefined && w . limitDollars !== undefined ) {
105105 return `$${ w . usageDollars . toFixed ( 2 ) } /$${ w . limitDollars . toFixed ( 0 ) } ` ;
@@ -123,5 +123,5 @@ export function formatGoUsage(usage: GoUsage): string {
123123 }
124124 const w = usage . rolling5h ?? usage . weekly ?? usage . monthly ;
125125 if ( w === undefined ) return "Go usage ok" ;
126- return `Go ${ usageWindowLabel ( usage ) } ${ formatUsagePercent ( w ) } ` ;
126+ return `Go ${ usageWindowLabel ( usage ) } ${ formatWindowUsage ( w ) } ` ;
127127}
Original file line number Diff line number Diff line change 11import {
2+ hostMatchesOpencodeDotAi ,
23 isKnownGoModel ,
34 isOpenCodeGoProvider ,
45} from "../../packages/opencode-go/src/index.js" ;
@@ -25,10 +26,7 @@ export function isBareZenBaseURL(baseURL: string): boolean {
2526 if ( BARE_ZEN_BASES . has ( trimmed ) ) return true ;
2627 try {
2728 const url = new URL ( trimmed ) ;
28- if (
29- url . hostname !== "opencode.ai" &&
30- ! url . hostname . endsWith ( ".opencode.ai" )
31- ) {
29+ if ( ! hostMatchesOpencodeDotAi ( url . hostname ) ) {
3230 return false ;
3331 }
3432 const path = url . pathname . replace ( / \/ + $ / , "" ) ;
You can’t perform that action at this time.
0 commit comments