@@ -52,6 +52,24 @@ fn acl_usize_attr(block: &a3s_acl::Block, keys: &[&str]) -> Option<usize> {
5252 }
5353}
5454
55+ fn acl_u32 ( value : & a3s_acl:: Value ) -> Option < u32 > {
56+ match value {
57+ a3s_acl:: Value :: Number ( value) if * value >= 0.0 => {
58+ Some ( ( * value as usize ) . min ( u32:: MAX as usize ) as u32 )
59+ }
60+ _ => None ,
61+ }
62+ }
63+
64+ fn acl_object_u32_attr ( value : & a3s_acl:: Value , key : & str ) -> Option < u32 > {
65+ match value {
66+ a3s_acl:: Value :: Object ( pairs) => pairs
67+ . iter ( )
68+ . find_map ( |( candidate, value) | ( candidate == key) . then ( || acl_u32 ( value) ) . flatten ( ) ) ,
69+ _ => None ,
70+ }
71+ }
72+
5573fn acl_path_list_attr ( block : & a3s_acl:: Block , keys : & [ & str ] ) -> Option < Vec < PathBuf > > {
5674 let value = acl_attr ( block, keys) ?;
5775 match value {
@@ -276,6 +294,37 @@ impl CodeConfig {
276294 model. release_date = Some ( release_date) ;
277295 }
278296 }
297+ "maxTokens" => {
298+ tracing:: warn!(
299+ provider = %provider. name,
300+ model = %model. id,
301+ field = "maxTokens" ,
302+ "Flat ACL model token limit fields are deprecated; use limit = {{ output = ..., context = ... }}"
303+ ) ;
304+ if let Some ( output) = acl_u32 ( value) {
305+ model. limit . output = output;
306+ }
307+ }
308+ "contextTokens" => {
309+ tracing:: warn!(
310+ provider = %provider. name,
311+ model = %model. id,
312+ field = "contextTokens" ,
313+ "Flat ACL model token limit fields are deprecated; use limit = {{ output = ..., context = ... }}"
314+ ) ;
315+ if let Some ( context) = acl_u32 ( value) {
316+ model. limit . context = context;
317+ }
318+ }
319+ "limit" => {
320+ if let Some ( output) = acl_object_u32_attr ( value, "output" ) {
321+ model. limit . output = output;
322+ }
323+ if let Some ( context) = acl_object_u32_attr ( value, "context" )
324+ {
325+ model. limit . context = context;
326+ }
327+ }
279328 _ => { }
280329 }
281330 }
0 commit comments