@@ -9,6 +9,9 @@ import type {
99 YoloSetResult ,
1010 McpSetVscodeToolsResult ,
1111 McpInvokeResponseResult ,
12+ LearnAuditEntry ,
13+ LearnRecommendation ,
14+ LearnRecommendResult ,
1215 RpcHistoryEntry ,
1316 DirectoryAccessResponseResult ,
1417 DirectoryAccessAcknowledgedResult ,
@@ -256,6 +259,63 @@ function mcpInvokeResponseResult(
256259 return { success : boolean ( record . success , method , `${ path } .success` ) } ;
257260}
258261
262+ function learnAuditStatus (
263+ value : unknown ,
264+ method : string ,
265+ path : string
266+ ) : LearnAuditEntry [ 'status' ] {
267+ if ( value === 'redundant' || value === 'outdated' || value === 'conflicting' ) return value ;
268+ return invalid ( method , path , 'redundant | outdated | conflicting' , value ) ;
269+ }
270+
271+ function learnAuditEntry ( value : unknown , method : string , path : string ) : LearnAuditEntry {
272+ const record = object ( value , method , path ) ;
273+ return {
274+ skill : string ( record . skill , method , `${ path } .skill` ) ,
275+ status : learnAuditStatus ( record . status , method , `${ path } .status` ) ,
276+ reason : string ( record . reason , method , `${ path } .reason` ) ,
277+ } ;
278+ }
279+
280+ function learnRecommendation (
281+ value : unknown ,
282+ method : string ,
283+ path : string
284+ ) : LearnRecommendation {
285+ const record = object ( value , method , path ) ;
286+ return {
287+ slug : string ( record . slug , method , `${ path } .slug` ) ,
288+ score : number ( record . score , method , `${ path } .score` ) ,
289+ reason : string ( record . reason , method , `${ path } .reason` ) ,
290+ } ;
291+ }
292+
293+ function learnRecommendResult (
294+ value : unknown ,
295+ method : string ,
296+ path : string
297+ ) : LearnRecommendResult {
298+ const record = object ( value , method , path ) ;
299+ const result : LearnRecommendResult = {
300+ success : boolean ( record . success , method , `${ path } .success` ) ,
301+ projectSummary : string ( record . projectSummary , method , `${ path } .projectSummary` ) ,
302+ audit : array ( record . audit , method , `${ path } .audit` , learnAuditEntry ) ,
303+ recommendations : array (
304+ record . recommendations ,
305+ method ,
306+ `${ path } .recommendations` ,
307+ learnRecommendation
308+ ) ,
309+ gapAnalysis : record . gapAnalysis === null
310+ ? null
311+ : string ( record . gapAnalysis , method , `${ path } .gapAnalysis` ) ,
312+ } ;
313+ if ( record . error !== undefined ) {
314+ result . error = string ( record . error , method , `${ path } .error` ) ;
315+ }
316+ return result ;
317+ }
318+
259319interface ExtensionRpcResultMap {
260320 'autohand.permissionAcknowledged' : PermissionAcknowledgedResult ;
261321 'autohand.directoryAccessResponse' : DirectoryAccessResponseResult ;
@@ -268,6 +328,7 @@ interface ExtensionRpcResultMap {
268328 'autohand.yolo.set' : YoloSetResult ;
269329 'autohand.mcp.setVscodeTools' : McpSetVscodeToolsResult ;
270330 'autohand.mcp.invokeResponse' : McpInvokeResponseResult ;
331+ 'autohand.learn.recommend' : LearnRecommendResult ;
271332}
272333
273334export type ExtensionRpcMethod = keyof ExtensionRpcResultMap ;
@@ -297,6 +358,8 @@ const validators: {
297358 mcpSetVscodeToolsResult ( value , 'autohand.mcp.setVscodeTools' , path ) ,
298359 'autohand.mcp.invokeResponse' : ( value , path ) =>
299360 mcpInvokeResponseResult ( value , 'autohand.mcp.invokeResponse' , path ) ,
361+ 'autohand.learn.recommend' : ( value , path ) =>
362+ learnRecommendResult ( value , 'autohand.learn.recommend' , path ) ,
300363} ;
301364
302365export function validateExtensionRpcResult < Method extends ExtensionRpcMethod > (
0 commit comments