@@ -30,6 +30,8 @@ export interface FetchNotificationResult {
3030 } [ ] ;
3131 owner : string ;
3232 repo : string ;
33+ itemNumber : string ;
34+ itemType : 'issue' | 'pr' ;
3335 fileChanges ?: FileChange [ ] ;
3436 threadId : number ,
3537 notificationKey : string
@@ -54,8 +56,8 @@ export class FetchNotificationTool extends RepoToolBase<FetchNotificationToolPar
5456 thread_id : threadId
5557 } ) ;
5658 const threadData = thread . data ;
57- const issueNumber = threadData . subject . url . split ( '/' ) . pop ( ) ;
58- if ( issueNumber === undefined ) {
59+ const itemNumber = threadData . subject . url . split ( '/' ) . pop ( ) ;
60+ if ( itemNumber === undefined ) {
5961 return undefined ;
6062 }
6163 const lastUpdatedAt = threadData . updated_at ;
@@ -64,10 +66,11 @@ export class FetchNotificationTool extends RepoToolBase<FetchNotificationToolPar
6466 const owner = threadData . repository . owner . login ;
6567 const name = threadData . repository . name ;
6668 const { folderManager } = await this . getRepoInfo ( { owner, name } ) ;
67- const issueOrPR = await folderManager . resolveIssueOrPullRequest ( owner , name , Number ( issueNumber ) ) ;
69+ const issueOrPR = await folderManager . resolveIssueOrPullRequest ( owner , name , Number ( itemNumber ) ) ;
6870 if ( ! issueOrPR ) {
6971 throw new Error ( `No notification found with thread ID #${ threadId } .` ) ;
7072 }
73+ const itemType = issueOrPR instanceof PullRequestModel ? 'pr' : 'issue' ;
7174 const notificationKey = getNotificationKey ( owner , name , String ( issueOrPR . number ) ) ;
7275 const comments = issueOrPR . item . comments ?? [ ] ;
7376 let unreadComments : { body : string ; } [ ] ;
@@ -88,7 +91,9 @@ export class FetchNotificationTool extends RepoToolBase<FetchNotificationToolPar
8891 title : issueOrPR . title ,
8992 body : issueOrPR . body ,
9093 owner,
91- repo : name
94+ repo : name ,
95+ itemNumber,
96+ itemType
9297 } ;
9398 if ( issueOrPR instanceof PullRequestModel ) {
9499 const fileChanges = await issueOrPR . getFileChangesInfo ( ) ;
0 commit comments