@@ -126,9 +126,13 @@ function applyFieldsFilter(data: unknown, fields?: string): unknown {
126126 if ( Array . isArray ( data ) && data . length > 0 ) {
127127 const sample = data [ 0 ] as Record < string , unknown > ;
128128 const available = Object . keys ( sample ) ;
129- const invalid = keys . filter ( ( k ) => ! available . includes ( k ) ) ;
130- if ( invalid . length > 0 && invalid . length === keys . length ) {
131- console . error ( `Warning: No matching fields. Available: ${ available . slice ( 0 , 15 ) . join ( ", " ) } ` ) ;
129+ const matched = keys . filter ( ( k ) => available . includes ( k ) ) ;
130+ if ( matched . length === 0 ) {
131+ fail (
132+ "invalid_fields" ,
133+ `No matching fields: ${ keys . join ( ", " ) } ` ,
134+ `Available: ${ available . slice ( 0 , 20 ) . join ( ", " ) } ` ,
135+ ) ;
132136 }
133137 return data . map ( ( item ) => pickFields ( item as Record < string , unknown > , keys ) ) ;
134138 }
@@ -3579,7 +3583,13 @@ export function createProgram(): Command {
35793583 . requiredOption ( "--agent-id <id>" , "Agent ID" )
35803584 . action ( async ( opts ) => {
35813585 const client = buildClient ( program . opts ( ) ) ;
3582- await run ( ( ) => client . agents . delete ( opts . agentId ) ) ;
3586+ try {
3587+ await client . agents . delete ( opts . agentId ) ;
3588+ printResult ( { schema : "agenticflow.delete.v1" , deleted : true , id : opts . agentId , resource : "agent" } ) ;
3589+ } catch ( err ) {
3590+ const message = err instanceof Error ? err . message : String ( err ) ;
3591+ fail ( "request_failed" , message ) ;
3592+ }
35833593 } ) ;
35843594
35853595 agentCmd
0 commit comments