@@ -9,23 +9,37 @@ import {
99import { createBoundedModelCatalog } from "./bounded-model-catalog.js" ;
1010
1111// Bound live /models so a huge or hostile catalog cannot blow process memory.
12- export const MAX_GO_CATALOG_BYTES = 256 * 1024 ;
13- export const MAX_GO_CATALOG_MODELS = 1024 ;
14- export const MAX_ZEN_CATALOG_BYTES = 256 * 1024 ;
15- export const MAX_ZEN_CATALOG_MODELS = 1024 ;
12+ // One shared bound for both catalogs; the per-catalog names stay as aliases.
13+ const MAX_CATALOG_BYTES = 256 * 1024 ;
14+ const MAX_CATALOG_MODELS = 1024 ;
15+
16+ export const MAX_GO_CATALOG_BYTES = MAX_CATALOG_BYTES ;
17+ export const MAX_GO_CATALOG_MODELS = MAX_CATALOG_MODELS ;
18+ export const MAX_ZEN_CATALOG_BYTES = MAX_CATALOG_BYTES ;
19+ export const MAX_ZEN_CATALOG_MODELS = MAX_CATALOG_MODELS ;
20+
21+ // The two live catalogs differ only in source and label — one row each.
22+ const MODEL_CATALOG_CONFIGS = {
23+ go : {
24+ baseURL : OPENCODE_GO_BASE_URL ,
25+ seedIds : OPENCODE_GO_MODEL_IDS ,
26+ catalogLabel : "OpenCode Go" ,
27+ } ,
28+ zen : {
29+ baseURL : ZEN_DEFAULT_BASE_URL ,
30+ seedIds : ZEN_MODEL_IDS ,
31+ catalogLabel : "OpenCode Zen" ,
32+ } ,
33+ } as const ;
1634
1735const goCatalog = createBoundedModelCatalog ( {
18- baseURL : OPENCODE_GO_BASE_URL ,
19- seedIds : OPENCODE_GO_MODEL_IDS ,
20- catalogLabel : "OpenCode Go" ,
36+ ...MODEL_CATALOG_CONFIGS . go ,
2137 maxBytes : MAX_GO_CATALOG_BYTES ,
2238 maxModels : MAX_GO_CATALOG_MODELS ,
2339} ) ;
2440
2541const zenCatalog = createBoundedModelCatalog ( {
26- baseURL : ZEN_DEFAULT_BASE_URL ,
27- seedIds : ZEN_MODEL_IDS ,
28- catalogLabel : "OpenCode Zen" ,
42+ ...MODEL_CATALOG_CONFIGS . zen ,
2943 maxBytes : MAX_ZEN_CATALOG_BYTES ,
3044 maxModels : MAX_ZEN_CATALOG_MODELS ,
3145} ) ;
0 commit comments