ide на основе vs code · VibeGit
ide на основе vs code Это ide на основе vs code(code oss), в ней будет встроенный умный апи роутинг, свой маркет с плагинами(агент харнесс, поддержка java/kotlin/мобильной разработки, командная разработка проектов, orca, оркестратор агентов
krutaya-ide-na-osnove-vs-code / src / vs / sessions / contrib / onboardingTours / browser / newSessionViewV3Prompt.ts 1082 строк · изменён 14 нояб., 04:52
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
import { raceTimeout } from '../../../../base/common/async.js' ;
import { CancellationToken, CancellationTokenSource } from '../../../../base/common/cancellation.js' ;
import { Codicon } from '../../../../base/common/codicons.js' ;
import { CancellationError, isCancellationError } from '../../../../base/common/errors.js' ;
import { DisposableStore, MutableDisposable } from '../../../../base/common/lifecycle.js' ;
import { autorun } from '../../../../base/common/observable.js' ;
import { format } from '../../../../base/common/strings.js'
localize
IConfigurationService
IFileService
ILogService
ITelemetryService
IGitService
getGitHubRemoteInfo IGitHubRemoteInfo
getOnboardingDeveloperModeVariation isOnboardingDeveloperModeEnabled OnboardingDeveloperModeVariations
IWorkbenchAssignmentService
isAgentHostProviderId
IActiveSession
ISessionsService
INewSessionComposer INewSessionComposerService INewSessionPromptOption INewSessionPromptOptionsController NewSessionPromptOptionsState
getGitHubRepositoryFromUri
GitHubAuthenticationError
IGitHubRecentIssue IGitHubRecentPullRequest IGitHubRecentUserWork
IGitHubService
computeIssueIcon computePullRequestIcon GitHubIssueState GitHubPullRequestState
resolveGitHubRepositoryFromGitConfig
totalMs
summaryMs
linkageMs
reviewMs
prompt
taskPlaceholder
effectiveStrategy NewSessionViewV3EffectiveStrategy
fallbackReason NewSessionViewV3FallbackReason
title
url
strategy Exclude NewSessionViewV3EffectiveStrategy
options INewSessionPromptOption
fallbackReason NewSessionViewV3FallbackReason
session IActiveSession
workspaceUri
folderUri
repository IGitHubRemoteInfo
kind
kind
kind
kind context INewSessionViewV3RepositoryContext
kind candidate INewSessionViewV3GitHubCandidate
kind reason Extract NewSessionViewV3FallbackReason
kind value
kind reason GitHubLookupFailureReason
candidates INewSessionViewV3GitHubCandidate
failures GitHubLookupFailureReason
candidates INewSessionViewV3GitHubCandidate
failures GitHubLookupFailureReason
kind
issueCandidates INewSessionViewV3GitHubCandidate
pullRequestCandidates INewSessionViewV3GitHubCandidate
failures GitHubLookupFailureReason
kind reason Extract NewSessionViewV3FallbackReason
context INewSessionViewV3RepositoryContext
issueCandidates INewSessionViewV3GitHubCandidate
pullRequestCandidates INewSessionViewV3GitHubCandidate
failures GitHubLookupFailureReason
totalMs
summaryMs
linkageMs
reviewMs
_gitHubLookupTimeouts IGitHubLookupTimeouts
_assignmentService IWorkbenchAssignmentService
_configurationService IConfigurationService
_sessionsService ISessionsService
_newSessionComposerService INewSessionComposerService
_gitService IGitService
_fileService IFileService
_gitHubService IGitHubService
_telemetryService ITelemetryService
_logService ILogService
gitHubLookupTimeouts Partial IGitHubLookupTimeouts
_gitHubLookupTimeouts gitHubLookupTimeouts
token CancellationToken
_logService
configuredVariation
token isCancellationRequested
_logService
configuredVariation configuredVariation
configuredVariation token configuredVariation
plan configuredVariation
token
token isCancellationRequested
_logService
_logService
shown plan prompt plan taskPlaceholder token
_logService
configuredVariation plan effectiveStrategy plan fallbackReason shown
shown
NewSessionViewV3ConfiguredVariation
developerModeEnabled _configurationService
developerVariations _configurationService
configuredDeveloperVariation developerVariations developerVariations
developerVariations
developerVariation _configurationService
configuredDeveloperVariation developerModeEnabled
_logService
developerVariation
_logService
developerVariation
_logService
treatmentVariation _assignmentService
_logService
treatmentVariation
variation source NewSessionViewV3ConfiguredVariation
variation variation variation
variation
variation
_logService
configuredVariation NewSessionViewV3ConfiguredVariation token CancellationToken configuredFallbackReason NewSessionViewV3FallbackReason
composer
composer
_logService
configuredVariation
latestPlan INewSessionViewV3PromptOptionsPlan
resolveOptions refreshToken CancellationToken NewSessionPromptOptionsState
latestPlan refreshToken
kind options latestPlan options
composer setPromptOptionsController composer refreshPromptOptions
controller INewSessionPromptOptionsController
resolve resolveOptions
option option
composer controller
_logService
shown composer token
fallbackReason configuredFallbackReason latestPlan fallbackReason token isCancellationRequested
_logService
configuredVariation fallbackReason shown
shown
composer kind
_logService
configuredVariation
_logService
state token
token isCancellationRequested _newSessionComposerService activeComposer composer _sessionsService activeSession isCreated
composer
_logService
configuredVariation configuredFallbackReason latestPlan fallbackReason
shown composer state
fallbackReason configuredFallbackReason latestPlan fallbackReason
_logService
configuredVariation fallbackReason shown
shown
INewSessionComposer
activeSession _sessionsService activeSession
activeSession isCreated
_newSessionComposerService activeComposer
token CancellationToken INewSessionViewV3PromptOptionsPlan
_logService
operationCts token
latestProgress IGitHubPromptOptionsProgress
timedOut
candidates latestProgress latestProgress context
latestProgress issueCandidates latestProgress pullRequestCandidates
candidates candidates length
result
operationCts token progress latestProgress progress
_gitHubLookupTimeouts totalMs
timedOut
_logService
operationCts
timedOut result
result kind
result reason
candidates result issueCandidates result pullRequestCandidates
fallbackReason candidates length result failures
candidates fallbackReason
error
error timedOut
error token isCancellationRequested
_logService
error
_logService
_logService error
operationCts
token CancellationToken progress IGitHubPromptOptionsProgress GitHubPromptOptionsResult
token isCancellationRequested
context token
context
_logService
kind reason
lookupCts token
owner context repository owner
repo context repository repo
issueResult IGitHubCandidateLookupResult
pullRequestResult IGitHubCandidateLookupResult
context
context
issueCandidates issueResult candidates
pullRequestCandidates pullRequestResult candidates
failures issueResult failures pullRequestResult failures
issueResult owner repo lookupCts token
issueResult
pullRequestResult owner repo lookupCts token candidates
pullRequestResult candidates failures
pullRequestResult
issues pullRequests
context
_logService
kind
issueCandidates issues candidates
pullRequestCandidates pullRequests candidates
failures issues failures pullRequests failures
lookupCts
kind reason
owner repo token CancellationToken IGitHubCandidateLookupResult
outcome owner repo token
outcome kind
candidates failures outcome reason
candidates outcome value
compareUpdatedAtDescending
issue issue title issue title url issue url strategy
candidates failures
owner
repo
token CancellationToken
candidates INewSessionViewV3GitHubCandidate
IGitHubCandidateLookupResult
summary
_gitHubLookupTimeouts summaryMs
token
lookupToken _gitHubService owner repo lookupToken
summary kind
candidates failures summary reason
pullRequests summary value compareUpdatedAtDescending
directCandidates pullRequests
pullRequest index index candidate pullRequest
entry entry index candidate INewSessionViewV3GitHubCandidate entry candidate
secondDirectCandidateIndex directCandidates index pullRequests length
reviewPullRequests pullRequests
secondDirectCandidateIndex
pullRequest pullRequest
stableCandidates
pullRequests reviewPullRequests pullRequests reviewPullRequests secondDirectCandidateIndex
directCandidates entry entry candidate
stableCandidates length
stableCandidates
reviewLookup owner repo reviewPullRequests token
candidates
pullRequests
directCandidates entry entry candidate reviewLookup candidates
candidates
candidates
failures reviewLookup failures
token CancellationToken INewSessionViewV3PromptPlan
_logService
operationCts token
timedOut
result
operationCts token
_gitHubLookupTimeouts totalMs
timedOut
_logService
operationCts
timedOut
result
result kind
_logService
result reason
_logService
result candidate
error
error timedOut
error token isCancellationRequested
_logService
error
_logService
_logService error
operationCts
token CancellationToken GitHubPromptResult
token isCancellationRequested
context token
context
_logService
kind reason
lookupCts token
owner context repository owner
repo context repository repo
_logService
issuesLookup owner repo lookupCts token
pullRequestsLookup
_gitHubLookupTimeouts summaryMs
lookupCts token
lookupToken _gitHubService owner repo lookupToken
context
_logService
failures GitHubLookupFailureReason
pullRequestsLookup kind
pullRequests pullRequestsLookup value compareUpdatedAtDescending
directCandidates pullRequests
pullRequest index index candidate pullRequest
entry entry index candidate INewSessionViewV3GitHubCandidate entry candidate
_logService
directCandidates index
kind candidate directCandidates candidate
firstDirectCandidateIndex directCandidates index pullRequests length
reviewPullRequests pullRequests
firstDirectCandidateIndex
pullRequest pullRequest
reviewLookup owner repo reviewPullRequests lookupCts token
failures reviewLookup failures
context
_logService
candidate
pullRequests
directCandidates entry entry candidate reviewLookup candidates
candidate
kind candidate
failures pullRequestsLookup reason
issues issuesLookup
context
_logService
issues kind
_logService
issue issues value compareUpdatedAtDescending
issue
kind candidate issue title issue title url issue url strategy
failures issues reason
_logService
kind reason failures
lookupCts
_logService
kind reason
owner repo token CancellationToken GitHubLookupOutcome IGitHubRecentIssue
issues
_gitHubLookupTimeouts summaryMs
token
lookupToken _gitHubService owner repo lookupToken
issues kind issues value length
issues
linkedIssues
_gitHubLookupTimeouts linkageMs
token
lookupToken _gitHubService owner repo issues value issue issue lookupToken
linkedIssues kind
unlinkedIssues issues value issue linkedIssues value issue
_logService
kind value unlinkedIssues
linkedIssues reason token isCancellationRequested
linkedIssues
_logService
issues
owner
repo
pullRequests IGitHubRecentPullRequest
token CancellationToken
IGitHubReviewLookupResult
eligiblePullRequests pullRequests pullRequest pullRequest latestCommitAt
eligiblePullRequests length
_logService
candidates failures
_logService
results eligiblePullRequests pullRequest
outcome
_gitHubLookupTimeouts reviewMs
token
lookupToken _gitHubService owner repo pullRequest lookupToken
outcome kind
completedPullRequest pullRequest reviewThreads outcome value
pullRequest completedPullRequest outcome
pullRequest outcome
completedPullRequests IGitHubRecentPullRequest
failures GitHubLookupFailureReason
result results
result outcome kind
completedPullRequests result pullRequest
failures result outcome reason
reviewPullRequests completedPullRequests compareUpdatedAtDescending hasUnaddressedReviewComments
_logService
candidates reviewPullRequests pullRequest pullRequest
failures
label
timeoutMs
token CancellationToken
token CancellationToken
GitHubLookupOutcome
lookupCts token
startTime Date
timedOut
_logService
value
lookupCts token
timeoutMs
timedOut
_logService
lookupCts
timedOut value
kind reason
_logService
kind value
error
timedOut
kind reason
error
_logService
kind reason
error token isCancellationRequested
_logService
kind reason
_logService error
kind reason
lookupCts
token CancellationToken INewSessionViewV3RepositoryContext
token isCancellationRequested
activeSession _sessionsService activeSession
activeSession
_logService
activeSession isCreated
_logService
workspace activeSession workspace
folder workspace folders
enterpriseHost _gitHubService enterpriseHost
supportedHosts enterpriseHost enterpriseHost
activeSession
workspace folder
_logService
gitHubInfo folder gitRepository gitHubInfo
enterpriseHost gitHubInfo
_logService
activeSession workspace uri folder workingDirectory owner gitHubInfo owner repo gitHubInfo repo
repositoryFromUri enterpriseHost folder root
folder workingDirectory
folder gitRepository folder gitRepository uri
repositoryFromUri
_logService
activeSession workspace uri folder workingDirectory repositoryFromUri
repositoryFromConfig _fileService folder workingDirectory supportedHosts
repositoryFromConfig
_logService
activeSession workspace uri folder workingDirectory repositoryFromConfig
_logService
error
_logService error
enterpriseHost activeSession providerId
_logService
result activeSession token
result kind
_logService
result kind
_logService
result kind
_logService
result context
_logService
repository _gitService folder workingDirectory
repository
_logService
repositoryFromRemote repository state supportedHosts
repositoryFromRemote
_logService
_logService
activeSession workspace uri folder workingDirectory repositoryFromRemote
activeSession IActiveSession token CancellationToken AgentHostRepositoryResolution
resolve reject
disposables
reaction disposables
result AgentHostRepositoryResolution
disposables
result
reaction value reader
_sessionsService activeSession reader activeSession activeSession isCreated reader
kind
workspace activeSession workspace reader
folder workspace folders
gitRepository folder gitRepository
gitHubInfo gitRepository gitHubInfo reader
workspace folder gitHubInfo
kind
context activeSession workspace uri folder workingDirectory owner gitHubInfo owner repo gitHubInfo repo
gitRepository hasGitHubRemote
kind
disposables token
disposables
token isCancellationRequested
disposables
activeSession IActiveSession
workspace activeSession workspace
folder workspace folders
gitRepository folder gitRepository
gitHubInfo gitRepository gitHubInfo
_logService
session IActiveSession workspaceUri folderUri repository IGitHubRemoteInfo INewSessionViewV3RepositoryContext
session
workspaceUri
folderUri
repository
context INewSessionViewV3RepositoryContext
activeSession _sessionsService activeSession
workspace activeSession workspace
activeSession context session
workspace uri context workspaceUri
workspace folders workingDirectory context folderUri
fallbackReason NewSessionViewV3FallbackReason INewSessionViewV3PromptPlan
promptTemplateTreatment placeholderTreatment
_assignmentService
_assignmentService
hasTreatment promptTemplateTreatment promptTemplateTreatment
placeholderTreatment placeholderTreatment
promptTemplate hasTreatment promptTemplateTreatment
taskPlaceholder hasTreatment placeholderTreatment
hasTreatment
_logService
_logService
prompt promptTemplate taskPlaceholder
taskPlaceholder
effectiveStrategy
fallbackReason
candidates INewSessionViewV3GitHubCandidate fallbackReason NewSessionViewV3FallbackReason INewSessionViewV3PromptOptionsPlan
gitHubOptions candidates candidate candidate
standardOptions
options gitHubOptions standardOptions gitHubOptions length
fallbackReason
candidate INewSessionViewV3GitHubCandidate INewSessionPromptOption
plan candidate
title candidate strategy
candidate strategy
candidate strategy
icon candidate strategy
GitHubIssueState Open
GitHubPullRequestState Open
hasMergeConflicts candidate strategy
hasFailingChecks candidate strategy
hasUnresolvedComments candidate strategy
id
title
titleDetail
description candidate title
prompt plan prompt
placeholder
icon
INewSessionPromptOption
implementFeaturePlaceholder
fixBugPlaceholder
fixCiPlaceholder
id
title
description
prompt implementFeaturePlaceholder
placeholder implementFeaturePlaceholder
icon Codicon lightbulbSparkleAutofix
id
title
description
prompt fixBugPlaceholder
placeholder fixBugPlaceholder
icon Codicon bug
id
title
description
prompt fixCiPlaceholder
placeholder fixCiPlaceholder
icon Codicon runErrors
candidate INewSessionViewV3GitHubCandidate INewSessionViewV3PromptPlan
prompt candidate strategy
candidate title candidate url
candidate strategy
candidate title candidate url
candidate strategy
candidate title candidate url
candidate title candidate url
prompt
taskPlaceholder
effectiveStrategy candidate strategy
fallbackReason
prompt taskPlaceholder token CancellationToken
activeSession _sessionsService activeSession
activeSession isCreated
_logService
composer _newSessionComposerService activeComposer
composer
_logService
_logService
composer prompt taskPlaceholder token
configuredVariation NewSessionViewV3ConfiguredVariation effectiveStrategy NewSessionViewV3EffectiveStrategy fallbackReason NewSessionViewV3FallbackReason shown
scenarioId
configuredVariation
effectiveStrategy
fallbackReason
shown
owner
comment
scenarioId classification purpose comment
configuredVariation classification purpose comment
effectiveStrategy classification purpose comment
fallbackReason classification purpose comment
shown classification purpose comment
_telemetryService
scenarioId
configuredVariation
effectiveStrategy
fallbackReason
shown
interaction option INewSessionPromptOption
scenarioId
interaction
option
owner
comment
scenarioId classification purpose comment
interaction classification purpose comment
option classification purpose comment
_telemetryService
scenarioId
interaction
option option option
recentWork IGitHubRecentUserWork INewSessionViewV3GitHubCandidate
pullRequests recentWork pullRequests compareUpdatedAtDescending
pullRequestCandidate pullRequests toPullRequestCandidate candidate candidate
pullRequestCandidate
pullRequestCandidate
issue recentWork issues compareUpdatedAtDescending
issue issue title issue title url issue url strategy
pullRequest IGitHubRecentPullRequest
pullRequest statusCheckRollupState pullRequest statusCheckRollupState
pullRequest IGitHubRecentPullRequest INewSessionViewV3GitHubCandidate
pullRequest hasMergeConflicts
pullRequest
pullRequest
pullRequest
pullRequest IGitHubRecentPullRequest INewSessionViewV3GitHubCandidate
pullRequest
pullRequest pullRequest
pullRequest IGitHubRecentPullRequest
latestCommitAt pullRequest latestCommitAt Date pullRequest latestCommitAt
Number latestCommitAt
pullRequest reviewThreads thread
latestCommentAt thread latestCommentAt Date thread latestCommentAt
thread isResolved Number latestCommentAt latestCommentAt latestCommitAt
failures GitHubLookupFailureReason Extract NewSessionViewV3FallbackReason
failures
failures
failures
a updatedAt b updatedAt
Date b updatedAt Date a updatedAt
pullRequests IGitHubRecentPullRequest
candidates INewSessionViewV3GitHubCandidate
INewSessionViewV3GitHubCandidate
candidatesByNumber candidates candidate candidate candidate
pullRequests pullRequest candidatesByNumber pullRequest candidate candidate
pullRequest IGitHubRecentPullRequest strategy INewSessionViewV3GitHubCandidate
pullRequest title pullRequest title url pullRequest url strategy
option INewSessionPromptOption
option id
option id
value
value length value value value
;
import
{
}
from
'../../../../nls.js'
;
import
{
}
from
'../../../../platform/configuration/common/configuration.js'
;
import
{
}
from
'../../../../platform/files/common/files.js'
;
import
{
}
from
'../../../../platform/log/common/log.js'
;
import
{
}
from
'../../../../platform/telemetry/common/telemetry.js'
;
import
{
}
from
'../../../../workbench/contrib/git/common/gitService.js'
;
import
{
,
}
from
'../../../../workbench/contrib/git/common/utils.js'
;
import
{
,
,
,
ONBOARDING_DEVELOPER_MODE_VARIATIONS_CONFIG
}
from
'../../../../workbench/contrib/onboarding/common/onboardingScenarioService.js'
;
import
{
}
from
'../../../../workbench/services/assignment/common/assignmentService.js'
;
import
{
}
from
'../../../common/agentHostSessionsProvider.js'
;
import
{
}
from
'../../../services/sessions/common/sessionsManagement.js'
;
import
{
}
from
'../../../services/sessions/browser/sessionsService.js'
;
import
{
,
,
,
,
NEW_SESSION_PROMPT_TYPING_DURATION_MS
,
}
from
'../../chat/browser/newSessionComposerService.js'
;
import
{
}
from
'../../github/common/utils.js'
;
import
{
}
from
'../../github/browser/githubApiClient.js'
;
import
{
,
,
}
from
'../../github/browser/fetchers/githubRecentUserWorkFetcher.js'
;
import
{
}
from
'../../github/browser/githubService.js'
;
import
{
,
,
,
}
from
'../../github/common/types.js'
;
import
{
}
from
'./gitHubRepositoryResolver.js'
;
import
{
NEW_SESSION_VIEW_V3_GITHUB_PROMPT_VARIATION
,
NEW_SESSION_VIEW_V3_OPTIONS_VARIATION
,
NEW_SESSION_VIEW_V3_PROMPT_VARIATION
,
NEW_SESSION_VIEW_V3_TOUR_ID
,
NEW_SESSION_VIEW_V3_VARIATION_TREATMENT
}
from
'./tours/newSessionViewV3Tour.js'
;
const
DEFAULT_GITHUB_LOOKUP_TIMEOUTS
=
{
:
10_000
,
:
5_000
,
:
2_500
,
:
4_000
,
}
;
const
LOG_PREFIX
=
'[NewSessionViewV3Prompt]'
;
const
PROMPT_TEMPLATE_TREATMENT
=
'onb.newSessionViewV3.promptTemplate'
;
const
PLACEHOLDER_TREATMENT
=
'onb.newSessionViewV3.placeholder'
;
const
DEFAULT_TASK_PLACEHOLDER
=
localize
(
'sessions.onboarding.newSessionViewV3.prompt.taskPlaceholder'
,
"[describe the coding task]"
)
;
const
DEFAULT_PROMPT_TEMPLATE
=
localize
(
'sessions.onboarding.newSessionViewV3.prompt.text'
,
"Help me complete {0} in this project. First, inspect the relevant files and explain your approach briefly. Then implement the solution using existing project conventions, avoid unrelated changes, and run the most relevant tests or checks. If anything is unclear, make a reasonable assumption and state it. When finished, summarize what changed and mention any remaining issues."
)
;
const
PROMPT_OPTION_COUNT
=
3
;
export
type
NewSessionViewV3ConfiguredVariation
=
'prompt'
|
'githubPrompt'
|
'options'
|
'unknown'
;
export
type
NewSessionViewV3EffectiveStrategy
=
'prompt'
|
'options'
|
'githubMergeConflict'
|
'githubCiFailure'
|
'githubReviewComments'
|
'githubIssue'
;
export
type
NewSessionViewV3FallbackReason
=
'none'
|
'unsupportedVariation'
|
'noRepository'
|
'noAuthentication'
|
'timeout'
|
'requestFailed'
|
'noCandidate'
;
interface
INewSessionViewV3PromptPlan
{
readonly
:
string
;
readonly
:
string
;
readonly
:
;
readonly
:
;
}
interface
INewSessionViewV3GitHubCandidate
{
readonly
number
:
number
;
readonly
:
string
;
readonly
:
string
;
readonly
:
<
,
'prompt'
|
'options'
>
;
}
interface
INewSessionViewV3PromptOptionsPlan
{
readonly
:
readonly
[
]
;
readonly
:
;
}
interface
INewSessionViewV3RepositoryContext
{
readonly
:
;
readonly
:
string
;
readonly
:
string
;
readonly
:
;
}
type
AgentHostRepositoryResolution
=
|
{
readonly
:
'pending'
}
|
{
readonly
:
'sessionChanged'
}
|
{
readonly
:
'noGitHubRemote'
}
|
{
readonly
:
'resolved'
;
readonly
:
}
;
type
GitHubPromptResult
=
|
{
readonly
:
'candidate'
;
readonly
:
}
|
{
readonly
:
'fallback'
;
readonly
:
<
,
'noRepository'
|
'noAuthentication'
|
'timeout'
|
'requestFailed'
|
'noCandidate'
>
}
;
type
GitHubLookupFailureReason
=
'noAuthentication'
|
'timeout'
|
'requestFailed'
|
'cancelled'
;
type
GitHubLookupOutcome< T >
=
|
{
readonly
:
'success'
;
readonly
:
T
}
|
{
readonly
:
'failure'
;
readonly
:
}
;
interface
IGitHubReviewLookupResult
{
readonly
:
readonly
[
]
;
readonly
:
readonly
[
]
;
}
interface
IGitHubCandidateLookupResult
{
readonly
:
readonly
[
]
;
readonly
:
readonly
[
]
;
}
type
GitHubPromptOptionsResult
=
|
{
readonly
:
'candidates'
;
readonly
:
readonly
[
]
;
readonly
:
readonly
[
]
;
readonly
:
readonly
[
]
;
}
|
{
readonly
:
'fallback'
;
readonly
:
<
,
'noRepository'
|
'noAuthentication'
|
'timeout'
|
'requestFailed'
|
'noCandidate'
>
}
;
interface
IGitHubPromptOptionsProgress
{
readonly
:
;
readonly
:
readonly
[
]
;
readonly
:
readonly
[
]
;
readonly
:
readonly
[
]
;
}
interface
IGitHubLookupTimeouts
{
readonly
:
number
;
readonly
:
number
;
readonly
:
number
;
readonly
:
number
;
}
export
class
NewSessionViewV3PromptRunner
{
private
readonly
:
;
constructor
(
private
readonly
:
,
private
readonly
:
,
private
readonly
:
,
private
readonly
:
,
private
readonly
:
,
private
readonly
:
,
private
readonly
:
,
private
readonly
:
,
private
readonly
:
,
:
<
>
=
{
}
,
)
{
this
.
=
{
...
DEFAULT_GITHUB_LOOKUP_TIMEOUTS
,
...
}
;
}
async
run
(
:
)
:
Promise
<
boolean
>
{
this
.
.
info
(
` ${ LOG_PREFIX } Starting V3 prompt resolution. `
)
;
const
=
await
this
.
_resolveConfiguredVariation
(
)
;
if
(
.
)
{
this
.
.
trace
(
` ${ LOG_PREFIX } Prompt resolution was cancelled after resolving the configured variation. `
)
;
return
false
;
}
if
(
===
'options'
||
===
'unknown'
)
{
return
this
.
_runPromptOptions
(
,
,
===
'unknown'
?
'unsupportedVariation'
:
undefined
)
;
}
const
=
===
'githubPrompt'
?
await
this
.
_resolveGitHubPromptWithFallback
(
)
:
await
this
.
_resolvePrompt
(
'none'
)
;
if
(
.
)
{
this
.
.
trace
(
` ${ LOG_PREFIX } Prompt resolution was cancelled before prompt insertion. `
)
;
return
false
;
}
this
.
.
info
(
` ${ LOG_PREFIX } Resolved effective strategy ' ${ plan. effectiveStrategy} ' with fallback reason ' ${ plan. fallbackReason} '. `
)
;
const
=
await
this
.
_animatePrompt
(
.
,
.
,
)
;
this
.
.
info
(
` ${ LOG_PREFIX } Prompt insertion completed with shown= ${ shown} . `
)
;
this
.
_reportStrategy
(
,
.
,
.
,
)
;
return
;
}
private
async
_resolveConfiguredVariation
(
)
:
Promise
<
>
{
const
=
isOnboardingDeveloperModeEnabled
(
this
.
,
NEW_SESSION_VIEW_V3_TOUR_ID
)
;
const
=
this
.
.
getValue < OnboardingDeveloperModeVariations | undefined >
(
ONBOARDING_DEVELOPER_MODE_VARIATIONS_CONFIG
)
;
const
=
typeof
===
'object'
&&
!==
null
?
[
NEW_SESSION_VIEW_V3_TOUR_ID
]
:
undefined
;
const
=
getOnboardingDeveloperModeVariation
(
this
.
,
NEW_SESSION_VIEW_V3_TOUR_ID
)
;
if
(
&&
!
)
{
this
.
.
warn
(
` ${ LOG_PREFIX } Ignoring developer variation ' ${ configuredDeveloperVariation} ' because developer mode is not enabled for ' ${ NEW_SESSION_VIEW_V3_TOUR_ID } '. `
)
;
}
if
(
)
{
this
.
.
info
(
` ${ LOG_PREFIX } Using developer variation ' ${ developerVariation} '. `
)
;
return
this
.
_normalizeVariation
(
,
'developer setting'
)
;
}
this
.
.
trace
(
` ${ LOG_PREFIX } No active developer variation; resolving treatment ' ${ NEW_SESSION_VIEW_V3_VARIATION_TREATMENT } '. `
)
;
const
=
await
this
.
.
getTreatment < string >
(
NEW_SESSION_VIEW_V3_VARIATION_TREATMENT
)
;
this
.
.
info
(
` ${ LOG_PREFIX } Treatment variation resolved to ' ${ treatmentVariation || NEW_SESSION_VIEW_V3_OPTIONS_VARIATION } '. `
)
;
return
this
.
_normalizeVariation
(
,
'treatment'
)
;
}
private
_normalizeVariation
(
:
string
|
undefined
,
:
string
)
:
{
if
(
===
undefined
||
===
''
||
===
NEW_SESSION_VIEW_V3_OPTIONS_VARIATION
)
{
return
'options'
;
}
if
(
===
NEW_SESSION_VIEW_V3_PROMPT_VARIATION
)
{
return
'prompt'
;
}
if
(
===
NEW_SESSION_VIEW_V3_GITHUB_PROMPT_VARIATION
)
{
return
'githubPrompt'
;
}
this
.
.
warn
(
` ${ LOG_PREFIX } Unsupported variation ' ${ variation} ' from ${ source} ; using ' ${ NEW_SESSION_VIEW_V3_OPTIONS_VARIATION } '. `
)
;
return
'unknown'
;
}
private
async
_runPromptOptions
(
:
,
:
,
?
:
)
:
Promise
<
boolean
>
{
const
=
this
.
_getActiveComposer
(
)
;
if
(
!
)
{
this
.
.
warn
(
` ${ LOG_PREFIX } Skipping prompt options because no active new-session composer is available. `
)
;
this
.
_reportStrategy
(
,
'options'
,
'noCandidate'
,
false
)
;
return
false
;
}
let
:
|
undefined
;
const
=
async
(
:
)
:
Promise
<
>
=>
{
=
await
this
.
_resolveGitHubPromptOptionsWithFallback
(
)
;
return
{
:
'resolved'
,
:
.
}
;
}
;
if
(
.
&&
.
)
{
const
:
=
{
:
,
onDidSelectOption
:
=>
this
.
_reportPromptOptionInteraction
(
'selected'
,
)
,
onDidClose
:
(
)
=>
this
.
_reportPromptOptionInteraction
(
'closed'
)
,
}
;
.
setPromptOptionsController
(
)
;
this
.
.
info
(
` ${ LOG_PREFIX } Showing prompt option loading skeletons. `
)
;
const
=
await
.
refreshPromptOptions
(
)
;
const
=
??
?.
??
(
.
?
'requestFailed'
:
'noCandidate'
)
;
this
.
.
info
(
` ${ LOG_PREFIX } Prompt options completed with shown= ${ shown} and fallback reason ' ${ fallbackReason} '. `
)
;
this
.
_reportStrategy
(
,
'options'
,
,
)
;
return
;
}
if
(
!
.
showPromptOptions
(
{
:
'loading'
}
)
)
{
this
.
.
warn
(
` ${ LOG_PREFIX } Skipping prompt options because the active new-session composer cannot show them. `
)
;
this
.
_reportStrategy
(
,
'options'
,
'noCandidate'
,
false
)
;
return
false
;
}
this
.
.
info
(
` ${ LOG_PREFIX } Showing prompt option loading skeletons. `
)
;
const
=
await
resolveOptions
(
)
;
if
(
.
||
this
.
.
.
get
(
)
!==
||
this
.
.
.
get
(
)
?.
.
get
(
)
)
{
.
showPromptOptions
(
undefined
)
;
this
.
.
trace
(
` ${ LOG_PREFIX } Prompt option resolution was cancelled or its composer is no longer active. `
)
;
this
.
_reportStrategy
(
,
'options'
,
??
?.
??
'requestFailed'
,
false
)
;
return
false
;
}
const
=
.
showPromptOptions
(
)
;
const
=
??
?.
??
'noCandidate'
;
this
.
.
info
(
` ${ LOG_PREFIX } Prompt options completed with shown= ${ shown} and fallback reason ' ${ fallbackReason} '. `
)
;
this
.
_reportStrategy
(
,
'options'
,
,
)
;
return
;
}
private
_getActiveComposer
(
)
:
|
undefined
{
const
=
this
.
.
.
get
(
)
;
if
(
?.
.
get
(
)
)
{
return
undefined
;
}
return
this
.
.
.
get
(
)
;
}
private
async
_resolveGitHubPromptOptionsWithFallback
(
:
)
:
Promise
<
>
{
this
.
.
info
(
` ${ LOG_PREFIX } Starting GitHub prompt option lookup with a ${ this . _gitHubLookupTimeouts. totalMs} ms total timeout. `
)
;
const
=
new
CancellationTokenSource
(
)
;
let
:
|
undefined
;
let
=
false
;
const
createTimeoutPlan
=
(
)
=>
{
const
=
&&
this
.
_isCurrentRepositoryContext
(
.
)
?
[
...
.
,
...
.
]
:
[
]
;
return
this
.
_createPromptOptionsPlan
(
.
slice
(
0
,
PROMPT_OPTION_COUNT
)
,
.
===
PROMPT_OPTION_COUNT
?
'none'
:
'timeout'
)
;
}
;
try
{
const
=
await
raceTimeout
(
this
.
_resolveGitHubPromptOptions
(
.
,
=>
=
)
,
this
.
.
,
(
)
=>
{
=
true
;
this
.
.
warn
(
` ${ LOG_PREFIX } GitHub prompt option lookup timed out after ${ this . _gitHubLookupTimeouts. totalMs} ms; filling with standard options. `
)
;
.
cancel
(
)
;
}
,
)
;
if
(
||
!
)
{
return
createTimeoutPlan
(
)
;
}
if
(
.
===
'fallback'
)
{
return
this
.
_createPromptOptionsPlan
(
[
]
,
.
)
;
}
const
=
[
...
.
,
...
.
]
.
slice
(
0
,
PROMPT_OPTION_COUNT
)
;
const
=
.
===
PROMPT_OPTION_COUNT
?
'none'
:
getLookupFallbackReason
(
.
)
;
return
this
.
_createPromptOptionsPlan
(
,
)
;
}
catch
(
)
{
if
(
isCancellationError
(
)
&&
)
{
return
createTimeoutPlan
(
)
;
}
if
(
isCancellationError
(
)
&&
.
)
{
this
.
.
trace
(
` ${ LOG_PREFIX } GitHub prompt option lookup was cancelled by the onboarding flow. `
)
;
return
this
.
_createPromptOptionsPlan
(
[
]
,
'requestFailed'
)
;
}
if
(
instanceof
GitHubAuthenticationError
)
{
this
.
.
warn
(
` ${ LOG_PREFIX } No existing GitHub authentication session is available; filling with standard options without requesting sign-in. `
)
;
return
this
.
_createPromptOptionsPlan
(
[
]
,
'noAuthentication'
)
;
}
this
.
.
error
(
` ${ LOG_PREFIX } GitHub prompt option lookup failed; filling with standard options. `
,
)
;
return
this
.
_createPromptOptionsPlan
(
[
]
,
'requestFailed'
)
;
}
finally
{
.
dispose
(
)
;
}
}
private
async
_resolveGitHubPromptOptions
(
:
,
reportProgress
:
(
:
)
=>
void
)
:
Promise
<
>
{
while
(
!
.
)
{
const
=
await
this
.
_resolveGitHubRepository
(
)
;
if
(
!
)
{
this
.
.
warn
(
` ${ LOG_PREFIX } Could not resolve a GitHub repository for prompt options. `
)
;
return
{
:
'fallback'
,
:
'noRepository'
}
;
}
const
=
new
CancellationTokenSource
(
)
;
try
{
const
=
.
.
;
const
=
.
.
;
let
:
|
undefined
;
let
:
|
undefined
;
const
publishProgress
=
(
)
=>
{
if
(
this
.
_isCurrentRepositoryContext
(
)
)
{
reportProgress
(
{
,
:
?.
??
[
]
,
:
?.
??
[
]
,
:
[
...
(
?.
??
[
]
)
,
...
(
?.
??
[
]
)
]
,
}
)
;
}
}
;
publishProgress
(
)
;
const
resolveIssues
=
async
(
)
=>
{
=
await
this
.
_resolveIssuePromptOptionCandidates
(
,
,
.
)
;
publishProgress
(
)
;
return
;
}
;
const
resolvePullRequests
=
async
(
)
=>
{
=
await
this
.
_resolvePullRequestPromptOptionCandidates
(
,
,
.
,
=>
{
=
{
,
:
[
]
}
;
publishProgress
(
)
;
}
)
;
publishProgress
(
)
;
return
;
}
;
const
[
,
]
=
await
Promise
.
all
(
[
resolveIssues
(
)
,
resolvePullRequests
(
)
,
]
)
;
if
(
!
this
.
_isCurrentRepositoryContext
(
)
)
{
this
.
.
info
(
` ${ LOG_PREFIX } The selected workspace changed during prompt option lookup; retrying for the current workspace. `
)
;
continue
;
}
return
{
:
'candidates'
,
:
.
,
:
.
,
:
[
...
.
,
...
.
]
,
}
;
}
finally
{
.
dispose
(
true
)
;
}
}
return
{
:
'fallback'
,
:
'noRepository'
}
;
}
private
async
_resolveIssuePromptOptionCandidates
(
:
string
,
:
string
,
:
)
:
Promise
<
>
{
const
=
await
this
.
_resolveIssueCandidates
(
,
,
)
;
if
(
.
===
'failure'
)
{
return
{
:
[
]
,
:
[
.
]
}
;
}
const
=
[
...
.
]
.
sort
(
)
.
slice
(
0
,
2
)
.
map
(
=>
(
{
number
:
.
number
,
:
.
,
:
.
,
:
'githubIssue'
as
const
}
)
)
;
return
{
,
:
[
]
}
;
}
private
async
_resolvePullRequestPromptOptionCandidates
(
:
string
,
:
string
,
:
,
reportCandidates
:
(
:
readonly
[
]
)
=>
void
=
(
)
=>
undefined
,
)
:
Promise
<
>
{
const
=
await
this
.
_runGitHubLookup
(
'authored pull request summaries'
,
this
.
.
,
,
=>
this
.
.
getRecentAuthoredPullRequests
(
,
,
)
,
)
;
if
(
.
===
'failure'
)
{
return
{
:
[
]
,
:
[
.
]
}
;
}
const
=
[
...
.
]
.
sort
(
)
;
const
=
.
map
(
(
,
)
=>
(
{
,
:
toDirectPullRequestCandidate
(
)
}
)
)
.
filter
(
(
)
:
is
{
readonly
:
number
;
readonly
:
}
=>
.
!==
undefined
)
;
const
=
[
1
]
?.
??
.
;
const
=
.
slice
(
0
,
)
.
filter
(
=>
!
toDirectPullRequestCandidate
(
)
)
;
const
=
getCandidatesInPullRequestOrder
(
.
slice
(
0
,
[
0
]
?
.
indexOf
(
[
0
]
)
:
)
,
.
map
(
=>
.
)
,
)
.
slice
(
0
,
2
)
;
if
(
.
>
0
)
{
reportCandidates
(
)
;
}
const
=
await
this
.
_resolveReviewCandidates
(
,
,
,
)
;
const
=
getCandidatesInPullRequestOrder
(
,
[
...
.
map
(
=>
.
)
,
...
.
]
,
)
.
slice
(
0
,
2
)
;
reportCandidates
(
)
;
return
{
,
:
.
,
}
;
}
private
async
_resolveGitHubPromptWithFallback
(
:
)
:
Promise
<
>
{
this
.
.
info
(
` ${ LOG_PREFIX } Starting GitHub prompt lookup with a ${ this . _gitHubLookupTimeouts. totalMs} ms total timeout. `
)
;
const
=
new
CancellationTokenSource
(
)
;
let
=
false
;
try
{
const
=
await
raceTimeout
(
this
.
_resolveGitHubPrompt
(
.
)
,
this
.
.
,
(
)
=>
{
=
true
;
this
.
.
warn
(
` ${ LOG_PREFIX } GitHub prompt lookup timed out after ${ this . _gitHubLookupTimeouts. totalMs} ms; using the prompt variation. `
)
;
.
cancel
(
)
;
}
,
)
;
if
(
)
{
return
this
.
_resolvePrompt
(
'timeout'
)
;
}
if
(
!
)
{
return
this
.
_resolvePrompt
(
'timeout'
)
;
}
if
(
.
===
'fallback'
)
{
this
.
.
warn
(
` ${ LOG_PREFIX } GitHub prompt lookup requested fallback ' ${ result. reason} '; using the prompt variation. `
)
;
return
this
.
_resolvePrompt
(
.
)
;
}
this
.
.
info
(
` ${ LOG_PREFIX } Selected GitHub candidate strategy ' ${ result. candidate. strategy} '. `
)
;
return
this
.
_createGitHubPrompt
(
.
)
;
}
catch
(
)
{
if
(
isCancellationError
(
)
&&
)
{
return
this
.
_resolvePrompt
(
'timeout'
)
;
}
if
(
isCancellationError
(
)
&&
.
)
{
this
.
.
trace
(
` ${ LOG_PREFIX } GitHub prompt lookup was cancelled by the onboarding flow. `
)
;
return
this
.
_resolvePrompt
(
'requestFailed'
)
;
}
if
(
instanceof
GitHubAuthenticationError
)
{
this
.
.
warn
(
` ${ LOG_PREFIX } No existing GitHub authentication session is available; using the prompt variation without requesting sign-in. `
)
;
return
this
.
_resolvePrompt
(
'noAuthentication'
)
;
}
this
.
.
error
(
` ${ LOG_PREFIX } GitHub prompt lookup failed; using the prompt variation. `
,
)
;
return
this
.
_resolvePrompt
(
'requestFailed'
)
;
}
finally
{
.
dispose
(
)
;
}
}
private
async
_resolveGitHubPrompt
(
:
)
:
Promise
<
>
{
while
(
!
.
)
{
const
=
await
this
.
_resolveGitHubRepository
(
)
;
if
(
!
)
{
this
.
.
warn
(
` ${ LOG_PREFIX } Could not resolve a GitHub repository for the selected workspace. `
)
;
return
{
:
'fallback'
,
:
'noRepository'
}
;
}
const
=
new
CancellationTokenSource
(
)
;
const
=
.
.
;
const
=
.
.
;
this
.
.
info
(
` ${ LOG_PREFIX } Starting independent GitHub lookups for ' ${ owner} / ${ repo} '. `
)
;
const
=
this
.
_resolveIssueCandidates
(
,
,
.
)
;
try
{
const
=
await
this
.
_runGitHubLookup
(
'authored pull request summaries'
,
this
.
.
,
.
,
=>
this
.
.
getRecentAuthoredPullRequests
(
,
,
)
,
)
;
if
(
!
this
.
_isCurrentRepositoryContext
(
)
)
{
this
.
.
info
(
` ${ LOG_PREFIX } The selected workspace changed during the GitHub lookup; retrying for the current workspace. `
)
;
continue
;
}
const
:
[
]
=
[
]
;
if
(
.
===
'success'
)
{
const
=
[
...
.
]
.
sort
(
)
;
const
=
.
map
(
(
,
)
=>
(
{
,
:
toDirectPullRequestCandidate
(
)
}
)
)
.
filter
(
(
)
:
is
{
readonly
:
number
;
readonly
:
}
=>
.
!==
undefined
)
;
this
.
.
info
(
` ${ LOG_PREFIX } Pull request summary lookup returned ${ pullRequests. length} open authored pull request(s), including ${ pullRequests. filter ( pullRequest => pullRequest. hasMergeConflicts) . length} with merge conflicts and ${ pullRequests. filter ( isFailingPullRequest) . length} with failing CI. `
)
;
if
(
[
0
]
?.
===
0
)
{
return
{
:
'candidate'
,
:
[
0
]
.
}
;
}
const
=
[
0
]
?.
??
.
;
const
=
.
slice
(
0
,
)
.
filter
(
=>
!
toDirectPullRequestCandidate
(
)
)
;
const
=
await
this
.
_resolveReviewCandidates
(
,
,
,
.
)
;
.
push
(
...
.
)
;
if
(
!
this
.
_isCurrentRepositoryContext
(
)
)
{
this
.
.
info
(
` ${ LOG_PREFIX } The selected workspace changed during review lookup; retrying for the current workspace. `
)
;
continue
;
}
const
=
getCandidatesInPullRequestOrder
(
,
[
...
.
map
(
=>
.
)
,
...
.
]
,
)
[
0
]
;
if
(
)
{
return
{
:
'candidate'
,
}
;
}
}
else
{
.
push
(
.
)
;
}
const
=
await
;
if
(
!
this
.
_isCurrentRepositoryContext
(
)
)
{
this
.
.
info
(
` ${ LOG_PREFIX } The selected workspace changed during issue lookup; retrying for the current workspace. `
)
;
continue
;
}
if
(
.
===
'success'
)
{
this
.
.
info
(
` ${ LOG_PREFIX } Issue lookup returned ${ issues. value. length} unlinked open issue(s) assigned to the user. `
)
;
const
=
[
...
.
]
.
sort
(
)
[
0
]
;
if
(
)
{
return
{
:
'candidate'
,
:
{
number
:
.
number
,
:
.
,
:
.
,
:
'githubIssue'
}
}
;
}
}
else
{
.
push
(
.
)
;
}
this
.
.
warn
(
` ${ LOG_PREFIX } No eligible GitHub candidate was available from the lookups that completed in time. `
)
;
return
{
:
'fallback'
,
:
getLookupFallbackReason
(
)
}
;
}
finally
{
.
dispose
(
true
)
;
}
}
this
.
.
trace
(
` ${ LOG_PREFIX } GitHub prompt lookup stopped because it was cancelled. `
)
;
return
{
:
'fallback'
,
:
'noRepository'
}
;
}
private
async
_resolveIssueCandidates
(
:
string
,
:
string
,
:
)
:
Promise
<
<
readonly
[
]
>>
{
const
=
await
this
.
_runGitHubLookup
(
'assigned issue summaries'
,
this
.
.
,
,
=>
this
.
.
getRecentAssignedIssues
(
,
,
)
,
)
;
if
(
.
===
'failure'
||
.
.
===
0
)
{
return
;
}
const
=
await
this
.
_runGitHubLookup
(
'issue pull request linkage'
,
this
.
.
,
,
=>
this
.
.
getIssuesWithLinkedPullRequests
(
,
,
.
.
map
(
=>
.
number
)
,
)
,
)
;
if
(
.
===
'success'
)
{
const
=
.
.
filter
(
=>
!
.
.
has
(
.
number
)
)
;
this
.
.
info
(
` ${ LOG_PREFIX } Issue linkage lookup excluded ${ issues. value. length - unlinkedIssues. length} issue(s) with related pull requests. `
)
;
return
{
:
'success'
,
:
}
;
}
if
(
.
===
'cancelled'
&&
.
)
{
return
;
}
this
.
.
warn
(
` ${ LOG_PREFIX } Issue linkage was unavailable ( ${ linkedIssues. reason} ); treating all assigned issues as having no related pull request. `
)
;
return
;
}
private
async
_resolveReviewCandidates
(
:
string
,
:
string
,
:
readonly
[
]
,
:
,
)
:
Promise
<
>
{
const
=
.
filter
(
=>
!
!
.
)
;
if
(
.
===
0
)
{
this
.
.
info
(
` ${ LOG_PREFIX } No pull requests have a latest commit timestamp, so review-thread lookup is unnecessary. `
)
;
return
{
:
[
]
,
:
[
]
}
;
}
this
.
.
info
(
` ${ LOG_PREFIX } Starting ${ eligiblePullRequests. length} independent review-thread lookup(s). `
)
;
const
=
await
Promise
.
all
(
.
map
(
async
=>
{
const
=
await
this
.
_runGitHubLookup
(
` review threads for pull request # ${ pullRequest. number } `
,
this
.
.
,
,
=>
this
.
.
getPullRequestReviewThreads
(
,
,
.
number
,
)
,
)
;
if
(
.
===
'success'
)
{
const
=
{
...
,
:
.
}
;
return
{
:
,
}
;
}
return
{
,
}
;
}
)
)
;
const
:
[
]
=
[
]
;
const
:
[
]
=
[
]
;
for
(
const
of
)
{
if
(
.
.
===
'success'
)
{
.
push
(
.
)
;
}
else
{
.
push
(
.
.
)
;
}
}
const
=
.
sort
(
)
.
filter
(
)
;
this
.
.
info
(
` ${ LOG_PREFIX } Review-thread lookups completed for ${ completedPullRequests. length} of ${ eligiblePullRequests. length} pull request(s); ${ reviewPullRequests. length} eligible pull request(s) were found. `
)
;
return
{
:
.
map
(
=>
toCandidate
(
,
'githubReviewComments'
)
)
,
,
}
;
}
private
async
_runGitHubLookup < T >
(
:
string
,
:
number
,
:
,
lookup
:
(
:
)
=>
Promise
<
T
>
,
)
:
Promise
<
<
T
>>
{
const
=
new
CancellationTokenSource
(
)
;
const
=
.
now
(
)
;
let
=
false
;
this
.
.
trace
(
` ${ LOG_PREFIX } Starting ${ label} lookup with a ${ timeoutMs} ms timeout. `
)
;
try
{
const
=
await
raceTimeout
(
lookup
(
.
)
,
,
(
)
=>
{
=
true
;
this
.
.
warn
(
` ${ LOG_PREFIX } ${ capitalize ( label) } lookup timed out after ${ timeoutMs} ms. `
)
;
.
cancel
(
)
;
}
,
)
;
if
(
||
===
undefined
)
{
return
{
:
'failure'
,
:
'timeout'
}
;
}
this
.
.
info
(
` ${ LOG_PREFIX } ${ capitalize ( label) } lookup completed in ${ Date. now ( ) - startTime} ms. `
)
;
return
{
:
'success'
,
}
;
}
catch
(
)
{
if
(
)
{
return
{
:
'failure'
,
:
'timeout'
}
;
}
if
(
instanceof
GitHubAuthenticationError
)
{
this
.
.
warn
(
` ${ LOG_PREFIX } ${ capitalize ( label) } lookup could not run because no existing GitHub authentication session is available. `
)
;
return
{
:
'failure'
,
:
'noAuthentication'
}
;
}
if
(
isCancellationError
(
)
&&
.
)
{
this
.
.
trace
(
` ${ LOG_PREFIX } ${ capitalize ( label) } lookup was cancelled. `
)
;
return
{
:
'failure'
,
:
'cancelled'
}
;
}
this
.
.
error
(
` ${ LOG_PREFIX } ${ capitalize ( label) } lookup failed after ${ Date. now ( ) - startTime} ms. `
,
)
;
return
{
:
'failure'
,
:
'requestFailed'
}
;
}
finally
{
.
dispose
(
)
;
}
}
private
async
_resolveGitHubRepository
(
:
)
:
Promise
<
|
undefined
>
{
while
(
!
.
)
{
const
=
this
.
.
.
get
(
)
;
if
(
!
)
{
this
.
.
trace
(
` ${ LOG_PREFIX } No active draft session is available for repository resolution. `
)
;
return
undefined
;
}
if
(
.
.
get
(
)
)
{
this
.
.
trace
(
` ${ LOG_PREFIX } The active session is already created, so the V3 new-session prompt cannot resolve its repository. `
)
;
return
undefined
;
}
const
=
.
.
get
(
)
;
const
=
?.
[
0
]
;
const
=
this
.
.
;
const
=
?
[
]
:
undefined
;
this
.
_logWorkspaceSnapshot
(
)
;
if
(
!
||
!
)
{
this
.
.
trace
(
` ${ LOG_PREFIX } The active draft has no primary workspace folder. `
)
;
return
undefined
;
}
const
=
.
?.
.
get
(
)
;
if
(
!
&&
)
{
this
.
.
info
(
` ${ LOG_PREFIX } Resolved GitHub repository ' ${ gitHubInfo. owner} / ${ gitHubInfo. repo} ' from session metadata. `
)
;
return
this
.
_createRepositoryContext
(
,
.
.
toString
(
)
,
.
.
toString
(
)
,
{
:
.
,
:
.
}
)
;
}
const
=
?
undefined
:
getGitHubRepositoryFromUri
(
.
)
??
getGitHubRepositoryFromUri
(
.
)
??
(
.
?
getGitHubRepositoryFromUri
(
.
.
)
:
undefined
)
;
if
(
)
{
this
.
.
info
(
` ${ LOG_PREFIX } Resolved GitHub repository ' ${ repositoryFromUri. owner} / ${ repositoryFromUri. repo} ' from the workspace URI. `
)
;
return
this
.
_createRepositoryContext
(
,
.
.
toString
(
)
,
.
.
toString
(
)
,
)
;
}
try
{
const
=
await
resolveGitHubRepositoryFromGitConfig
(
this
.
,
.
,
)
;
if
(
)
{
this
.
.
info
(
` ${ LOG_PREFIX } Resolved GitHub repository ' ${ repositoryFromConfig. owner} / ${ repositoryFromConfig. repo} ' directly from .git/config. `
)
;
return
this
.
_createRepositoryContext
(
,
.
.
toString
(
)
,
.
.
toString
(
)
,
)
;
}
this
.
.
trace
(
` ${ LOG_PREFIX } No supported GitHub remote was found directly in .git/config. `
)
;
}
catch
(
)
{
this
.
.
warn
(
` ${ LOG_PREFIX } Reading Git repository metadata directly from the selected workspace failed. `
,
)
;
}
if
(
!
&&
isAgentHostProviderId
(
.
)
)
{
this
.
.
info
(
` ${ LOG_PREFIX } Waiting for Agent Host git metadata for the active draft. `
)
;
const
=
await
this
.
_waitForAgentHostRepository
(
,
)
;
if
(
.
===
'sessionChanged'
)
{
this
.
.
info
(
` ${ LOG_PREFIX } The active draft changed while waiting for Agent Host git metadata; retrying. `
)
;
continue
;
}
if
(
.
===
'noGitHubRemote'
)
{
this
.
.
info
(
` ${ LOG_PREFIX } Agent Host git metadata reports that the selected workspace has no GitHub remote. `
)
;
return
undefined
;
}
if
(
.
===
'resolved'
)
{
this
.
.
info
(
` ${ LOG_PREFIX } Resolved GitHub repository ' ${ result. context. repository. owner} / ${ result. context. repository. repo} ' from asynchronously published Agent Host metadata. `
)
;
return
.
;
}
}
this
.
.
trace
(
` ${ LOG_PREFIX } Session metadata, workspace URIs, and .git/config did not identify GitHub; inspecting Git extension remotes. `
)
;
const
=
await
this
.
.
openRepository
(
.
)
;
if
(
!
)
{
this
.
.
trace
(
` ${ LOG_PREFIX } The selected workspace folder could not be opened through the Git extension. `
)
;
return
undefined
;
}
const
=
getGitHubRemoteInfo
(
.
.
get
(
)
,
)
;
if
(
!
)
{
this
.
.
trace
(
` ${ LOG_PREFIX } The selected Git repository has no supported GitHub remote. `
)
;
return
undefined
;
}
this
.
.
info
(
` ${ LOG_PREFIX } Resolved GitHub repository ' ${ repositoryFromRemote. owner} / ${ repositoryFromRemote. repo} ' from Git extension remotes. `
)
;
return
this
.
_createRepositoryContext
(
,
.
.
toString
(
)
,
.
.
toString
(
)
,
)
;
}
return
undefined
;
}
private
_waitForAgentHostRepository
(
:
,
:
)
:
Promise
<
>
{
return
new
Promise
(
(
,
)
=>
{
const
=
new
DisposableStore
(
)
;
const
=
.
add
(
new
MutableDisposable
(
)
)
;
const
finish
=
(
:
)
=>
{
.
dispose
(
)
;
resolve
(
)
;
}
;
.
=
autorun
(
=>
{
if
(
this
.
.
.
read
(
)
!==
||
.
.
read
(
)
)
{
finish
(
{
:
'sessionChanged'
}
)
;
return
;
}
const
=
.
.
read
(
)
;
const
=
?.
[
0
]
;
const
=
?.
;
const
=
?.
.
read
(
)
;
if
(
&&
&&
)
{
finish
(
{
:
'resolved'
,
:
this
.
_createRepositoryContext
(
,
.
.
toString
(
)
,
.
.
toString
(
)
,
{
:
.
,
:
.
}
)
,
}
)
;
return
;
}
if
(
?.
===
false
)
{
finish
(
{
:
'noGitHubRemote'
}
)
;
}
}
)
;
.
add
(
.
onCancellationRequested
(
(
)
=>
{
.
dispose
(
)
;
reject
(
new
CancellationError
(
)
)
;
}
)
)
;
if
(
.
)
{
.
dispose
(
)
;
reject
(
new
CancellationError
(
)
)
;
}
}
)
;
}
private
_logWorkspaceSnapshot
(
:
)
:
void
{
const
=
.
.
get
(
)
;
const
=
?.
[
0
]
;
const
=
?.
;
const
=
?.
.
get
(
)
;
this
.
.
info
(
` ${ LOG_PREFIX } Workspace snapshot: provider=' ${ activeSession. providerId} ', sessionType=' ${ activeSession. sessionType} ', workspace=' ${ workspace?. uri. toString ( ) ?? 'none' } ', root=' ${ folder?. root. toString ( ) ?? 'none' } ', workingDirectory=' ${ folder?. workingDirectory. toString ( ) ?? 'none' } ', gitRepository=' ${ gitRepository?. uri. toString ( ) ?? 'none' } ', hasGitHubRemote= ${ String ( gitRepository?. hasGitHubRemote) } , gitHubRepository=' ${ gitHubInfo ? ` ${ gitHubInfo. owner} / ${ gitHubInfo. repo} ` : 'none' } '. `
)
;
}
private
_createRepositoryContext
(
:
,
:
string
,
:
string
,
:
)
:
{
return
{
,
,
,
,
}
;
}
private
_isCurrentRepositoryContext
(
:
)
:
boolean
{
const
=
this
.
.
.
get
(
)
;
const
=
?.
.
get
(
)
;
return
===
.
&&
?.
.
toString
(
)
===
.
&&
.
[
0
]
?.
.
toString
(
)
===
.
;
}
private
async
_resolvePrompt
(
:
)
:
Promise
<
>
{
const
[
,
]
=
await
Promise
.
all
(
[
this
.
.
getTreatment < string >
(
PROMPT_TEMPLATE_TREATMENT
)
,
this
.
.
getTreatment < string >
(
PLACEHOLDER_TREATMENT
)
,
]
)
;
const
=
typeof
===
'string'
&&
!
!
.
trim
(
)
&&
typeof
===
'string'
&&
!
!
.
trim
(
)
;
const
=
?
:
DEFAULT_PROMPT_TEMPLATE
;
const
=
?
:
DEFAULT_TASK_PLACEHOLDER
;
if
(
)
{
this
.
.
info
(
` ${ LOG_PREFIX } Using prompt template and placeholder from paired treatments. `
)
;
}
else
{
this
.
.
info
(
` ${ LOG_PREFIX } Prompt treatments were not both set to non-empty strings; using the default prompt template and placeholder. `
)
;
}
return
{
:
format
(
,
)
,
,
:
'prompt'
,
,
}
;
}
private
_createPromptOptionsPlan
(
:
readonly
[
]
,
:
)
:
{
const
=
.
slice
(
0
,
PROMPT_OPTION_COUNT
)
.
map
(
=>
this
.
_createGitHubPromptOption
(
)
)
;
const
=
this
.
_createStandardPromptOptions
(
)
;
return
{
:
[
...
,
...
.
slice
(
0
,
PROMPT_OPTION_COUNT
-
.
)
]
,
,
}
;
}
private
_createGitHubPromptOption
(
:
)
:
{
const
=
this
.
_createGitHubPrompt
(
)
;
const
=
.
===
'githubIssue'
?
localize
(
'sessions.onboarding.newSessionViewV3.options.githubIssue.title'
,
"Tackle issue"
)
:
.
===
'githubMergeConflict'
?
localize
(
'sessions.onboarding.newSessionViewV3.options.githubConflicts.title'
,
"Resolve conflicts"
)
:
.
===
'githubCiFailure'
?
localize
(
'sessions.onboarding.newSessionViewV3.options.githubCi.title'
,
"Fix CI"
)
:
localize
(
'sessions.onboarding.newSessionViewV3.options.githubReview.title'
,
"Address PR comments"
)
;
const
=
.
===
'githubIssue'
?
computeIssueIcon
(
.
,
undefined
)
:
computePullRequestIcon
(
.
,
{
:
.
===
'githubMergeConflict'
,
:
.
===
'githubCiFailure'
,
:
.
===
'githubReviewComments'
,
}
)
;
return
{
:
` ${ candidate. strategy} : ${ candidate. url} `
,
,
:
` # ${ candidate. number } `
,
:
.
,
:
.
,
:
''
,
,
}
;
}
private
_createStandardPromptOptions
(
)
:
readonly
[
]
{
const
=
localize
(
'sessions.onboarding.newSessionViewV3.options.implementFeature.placeholder'
,
"[describe the feature]"
)
;
const
=
localize
(
'sessions.onboarding.newSessionViewV3.options.fixBug.placeholder'
,
"[describe the bug]"
)
;
const
=
localize
(
'sessions.onboarding.newSessionViewV3.options.fixCi.placeholder'
,
"[describe the CI failure or paste a link]"
)
;
return
[
{
:
'standard:implementFeature'
,
:
localize
(
'sessions.onboarding.newSessionViewV3.options.implementFeature.title'
,
"Implement a feature"
)
,
:
localize
(
'sessions.onboarding.newSessionViewV3.options.implementFeature.description'
,
"Describe what you want to build"
)
,
:
localize
(
'sessions.onboarding.newSessionViewV3.options.implementFeature.prompt'
,
"Help me implement {0} in this project. Ask me questions if anything is unclear regarding the intended behaviour."
,
)
,
:
,
:
.
,
}
,
{
:
'standard:fixBug'
,
:
localize
(
'sessions.onboarding.newSessionViewV3.options.fixBug.title'
,
"Fix a bug"
)
,
:
localize
(
'sessions.onboarding.newSessionViewV3.options.fixBug.description'
,
"Describe the unexpected behavior"
)
,
:
localize
(
'sessions.onboarding.newSessionViewV3.options.fixBug.prompt'
,
"Help me fix {0} in this project. Ask me questions if anything is unclear regarding the bug or the intended behaviour."
,
)
,
:
,
:
.
,
}
,
{
:
'standard:fixCi'
,
:
localize
(
'sessions.onboarding.newSessionViewV3.options.fixCi.title'
,
"Fix CI"
)
,
:
localize
(
'sessions.onboarding.newSessionViewV3.options.fixCi.description'
,
"Describe a failing check or paste a link"
)
,
:
localize
(
'sessions.onboarding.newSessionViewV3.options.fixCi.prompt'
,
"Help me fix the failing CI for {0} in this project. Ask me questions if anything is unclear regarding the CI failure or how it should be fixed."
,
)
,
:
,
:
.
,
}
,
]
;
}
private
_createGitHubPrompt
(
:
)
:
{
const
=
.
===
'githubMergeConflict'
?
localize
(
'sessions.onboarding.newSessionViewV3.githubPrompt.mergeConflict'
,
"The following pull request has merge conflicts: \"{0}\" ({1}). Resolve the conflicts and update the pull request."
,
.
,
.
)
:
.
===
'githubCiFailure'
?
localize
(
'sessions.onboarding.newSessionViewV3.githubPrompt.ciFailure'
,
"The following pull request has failing CI checks: \"{0}\" ({1}). Investigate the failures and resolve them."
,
.
,
.
)
:
.
===
'githubReviewComments'
?
localize
(
'sessions.onboarding.newSessionViewV3.githubPrompt.reviewComments'
,
"The following pull request has unresolved review comments that have not been addressed by a newer commit: \"{0}\" ({1}). Address the review comments and update the pull request."
,
.
,
.
)
:
localize
(
'sessions.onboarding.newSessionViewV3.githubPrompt.issue'
,
"Tackle the following issue and create a pull request for it: \"{0}\" ({1})."
,
.
,
.
)
;
return
{
,
:
''
,
:
.
,
:
'none'
,
}
;
}
private
_animatePrompt
(
:
string
,
:
string
,
:
)
:
Promise
<
boolean
>
|
boolean
{
const
=
this
.
.
.
get
(
)
;
if
(
?.
.
get
(
)
)
{
this
.
.
warn
(
` ${ LOG_PREFIX } Skipping prompt insertion because the active session was created before animation started. `
)
;
return
false
;
}
const
=
this
.
.
.
get
(
)
;
if
(
!
)
{
this
.
.
warn
(
` ${ LOG_PREFIX } Skipping prompt insertion because no active new-session composer is available. `
)
;
return
false
;
}
this
.
.
trace
(
` ${ LOG_PREFIX } Animating the resolved prompt in the active new-session composer. `
)
;
return
.
animatePrompt
(
,
NEW_SESSION_PROMPT_TYPING_DURATION_MS
,
,
)
;
}
private
_reportStrategy
(
:
,
:
,
:
,
:
boolean
)
:
void
{
type
OnboardingPromptStrategyEvent
=
{
:
string
;
:
string
;
:
string
;
:
string
;
:
boolean
;
}
;
type
OnboardingPromptStrategyClassification
=
{
:
'benibenj'
;
:
'Reports which prompt experience an onboarding tour selected without collecting prompt or repository content.'
;
:
{
:
'SystemMetaData'
;
:
'FeatureInsight'
;
:
'The id of the onboarding scenario that ran.'
}
;
:
{
:
'SystemMetaData'
;
:
'FeatureInsight'
;
:
'The configured prompt experience, reduced to a known category.'
}
;
:
{
:
'SystemMetaData'
;
:
'FeatureInsight'
;
:
'The effective prompt or prompt-option strategy selected for the tour.'
}
;
:
{
:
'SystemMetaData'
;
:
'PerformanceAndHealth'
;
:
'The categorical reason GitHub personalization fell back to a default prompt or standard options.'
}
;
:
{
:
'SystemMetaData'
;
:
'FeatureInsight'
;
:
'Whether the selected prompt or prompt-option widget was shown.'
}
;
}
;
this
.
.
publicLog2 < OnboardingPromptStrategyEvent, OnboardingPromptStrategyClassification>
(
'onboarding.promptStrategy'
,
{
:
NEW_SESSION_VIEW_V3_TOUR_ID
,
,
,
,
,
}
)
;
}
private
_reportPromptOptionInteraction
(
:
'selected'
|
'closed'
,
?
:
)
:
void
{
type
OnboardingPromptOptionInteractionEvent
=
{
:
string
;
:
string
;
:
string
;
}
;
type
OnboardingPromptOptionInteractionClassification
=
{
:
'benibenj'
;
:
'Reports privacy-safe interactions with V3 onboarding prompt options without collecting prompt or repository content.'
;
:
{
:
'SystemMetaData'
;
:
'FeatureInsight'
;
:
'The id of the onboarding scenario that showed the prompt options.'
}
;
:
{
:
'SystemMetaData'
;
:
'FeatureInsight'
;
:
'Whether an option was selected or the prompt-option widget was closed.'
}
;
:
{
:
'SystemMetaData'
;
:
'FeatureInsight'
;
:
'The categorical prompt option selected, or none when the widget was closed.'
}
;
}
;
this
.
.
publicLog2 < OnboardingPromptOptionInteractionEvent, OnboardingPromptOptionInteractionClassification>
(
'onboarding.promptOptionInteraction'
,
{
:
NEW_SESSION_VIEW_V3_TOUR_ID
,
,
:
?
getPromptOptionTelemetryKind
(
)
:
'none'
,
}
)
;
}
}
export
function
selectNewSessionViewV3GitHubCandidate
(
:
)
:
|
undefined
{
const
=
[
...
.
]
.
sort
(
)
;
const
=
.
map
(
)
.
find
(
=>
!==
undefined
)
;
if
(
)
{
return
;
}
const
=
[
...
.
]
.
sort
(
)
[
0
]
;
return
?
{
number
:
.
number
,
:
.
,
:
.
,
:
'githubIssue'
}
:
undefined
;
}
function
isFailingPullRequest
(
:
)
:
boolean
{
return
.
===
'FAILURE'
||
.
===
'ERROR'
;
}
function
toDirectPullRequestCandidate
(
:
)
:
|
undefined
{
if
(
.
)
{
return
toCandidate
(
,
'githubMergeConflict'
)
;
}
if
(
isFailingPullRequest
(
)
)
{
return
toCandidate
(
,
'githubCiFailure'
)
;
}
return
undefined
;
}
function
toPullRequestCandidate
(
:
)
:
|
undefined
{
return
toDirectPullRequestCandidate
(
)
??
(
hasUnaddressedReviewComments
(
)
?
toCandidate
(
,
'githubReviewComments'
)
:
undefined
)
;
}
function
hasUnaddressedReviewComments
(
:
)
:
boolean
{
const
=
.
?
.
parse
(
.
)
:
NaN
;
if
(
!
.
isFinite
(
)
)
{
return
false
;
}
return
(
.
??
[
]
)
.
some
(
=>
{
const
=
.
?
.
parse
(
.
)
:
NaN
;
return
!
.
&&
.
isFinite
(
)
&&
>
;
}
)
;
}
function
getLookupFallbackReason
(
:
readonly
[
]
)
:
<
,
'noAuthentication'
|
'timeout'
|
'requestFailed'
|
'noCandidate'
>
{
if
(
.
includes
(
'noAuthentication'
)
)
{
return
'noAuthentication'
;
}
if
(
.
includes
(
'timeout'
)
)
{
return
'timeout'
;
}
if
(
.
includes
(
'requestFailed'
)
)
{
return
'requestFailed'
;
}
return
'noCandidate'
;
}
function
compareUpdatedAtDescending
(
:
{
readonly
:
string
}
,
:
{
readonly
:
string
}
)
:
number
{
return
.
parse
(
.
)
-
.
parse
(
.
)
;
}
function
getCandidatesInPullRequestOrder
(
:
readonly
[
]
,
:
readonly
[
]
,
)
:
[
]
{
const
=
new
Map
(
.
map
(
=>
[
.
number
,
]
)
)
;
return
.
map
(
=>
.
get
(
.
number
)
)
.
filter
(
=>
!==
undefined
)
;
}
function
toCandidate
(
:
,
:
'githubMergeConflict'
|
'githubCiFailure'
|
'githubReviewComments'
)
:
{
return
{
number
:
.
number
,
:
.
,
:
.
,
}
;
}
function
getPromptOptionTelemetryKind
(
:
)
:
'implementFeature'
|
'fixBug'
|
'fixCI'
|
'githubIssue'
|
'githubPRConflicts'
|
'githubPRCI'
|
'githubPRComments'
|
'unknown'
{
switch
(
.
.
split
(
':'
,
1
)
[
0
]
)
{
case
'standard'
:
switch
(
.
)
{
case
'standard:implementFeature'
:
return
'implementFeature'
;
case
'standard:fixBug'
:
return
'fixBug'
;
case
'standard:fixCi'
:
return
'fixCI'
;
default
:
return
'unknown'
;
}
case
'githubIssue'
:
return
'githubIssue'
;
case
'githubMergeConflict'
:
return
'githubPRConflicts'
;
case
'githubCiFailure'
:
return
'githubPRCI'
;
case
'githubReviewComments'
:
return
'githubPRComments'
;
default
:
return
'unknown'
;
}
}
function
capitalize
(
:
string
)
:
string
{
return
.
>
0
?
[
0
]
.
toUpperCase
(
)
+
.
slice
(
1
)
:
;
}