@app-vitals/agent-admin 1.86.1 → 1.88.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/openapi.json +2 -2
- package/openapi.platform.json +30 -2
- package/package.json +2 -2
- package/prisma/client/internal/class.ts +4 -4
- package/prisma/client/internal/prismaNamespace.ts +1 -0
- package/prisma/client/internal/prismaNamespaceBrowser.ts +1 -0
- package/prisma/client/models/GitHubRepoSnapshot.ts +33 -1
- package/prisma/migrations/20261125000000_add_github_snapshot_repository_selection/migration.sql +2 -0
- package/prisma/schema/schema.prisma +2 -0
- package/src/admin-ui-github-identity-pages.ts +22 -4
- package/src/admin-ui-github-identity-pages.unit.test.ts +87 -0
- package/src/admin-ui-installation-repos-pages.ts +29 -7
- package/src/admin-ui-installation-repos-pages.unit.test.ts +83 -0
- package/src/admin-ui-installation-repos.smoke.test.ts +77 -9
- package/src/admin-ui-pages.ts +15 -2
- package/src/admin-ui.ts +23 -17
- package/src/agents-api.smoke.test.ts +237 -2
- package/src/agents-api.ts +27 -4
- package/src/github-access-preview.integration.test.ts +38 -3
- package/src/github-access-preview.ts +1 -1
- package/src/github-agent-installation-crawler.ts +27 -8
- package/src/github-agent-installation-crawler.unit.test.ts +76 -1
- package/src/github-apps-state.ts +31 -0
- package/src/github-cache-roundtrip.integration.test.ts +405 -0
- package/src/github-enterprise-api.ts +24 -18
- package/src/github-installation-selection.integration.test.ts +91 -0
- package/src/github-installation-wiring.ts +35 -0
- package/src/github-repo-cache.ts +8 -0
- package/src/github-sync.ts +38 -4
- package/src/installation-ports.ts +2 -0
- package/src/installation-repos-service.ts +24 -1
- package/src/user-repo-access-resolver.ts +26 -5
- package/src/user-repo-access-resolver.unit.test.ts +80 -0
|
@@ -3580,6 +3580,7 @@ export const GitHubRepoSnapshotScalarFieldEnum = {
|
|
|
3580
3580
|
crawlStartedAt: 'crawlStartedAt',
|
|
3581
3581
|
completedAt: 'completedAt',
|
|
3582
3582
|
totalCount: 'totalCount',
|
|
3583
|
+
repositorySelection: 'repositorySelection',
|
|
3583
3584
|
lastError: 'lastError',
|
|
3584
3585
|
attempts: 'attempts',
|
|
3585
3586
|
nextAttemptAt: 'nextAttemptAt',
|
|
@@ -604,6 +604,7 @@ export const GitHubRepoSnapshotScalarFieldEnum = {
|
|
|
604
604
|
crawlStartedAt: 'crawlStartedAt',
|
|
605
605
|
completedAt: 'completedAt',
|
|
606
606
|
totalCount: 'totalCount',
|
|
607
|
+
repositorySelection: 'repositorySelection',
|
|
607
608
|
lastError: 'lastError',
|
|
608
609
|
attempts: 'attempts',
|
|
609
610
|
nextAttemptAt: 'nextAttemptAt',
|
|
@@ -48,6 +48,7 @@ export type GitHubRepoSnapshotMinAggregateOutputType = {
|
|
|
48
48
|
crawlStartedAt: Date | null
|
|
49
49
|
completedAt: Date | null
|
|
50
50
|
totalCount: number | null
|
|
51
|
+
repositorySelection: string | null
|
|
51
52
|
lastError: string | null
|
|
52
53
|
attempts: number | null
|
|
53
54
|
nextAttemptAt: Date | null
|
|
@@ -69,6 +70,7 @@ export type GitHubRepoSnapshotMaxAggregateOutputType = {
|
|
|
69
70
|
crawlStartedAt: Date | null
|
|
70
71
|
completedAt: Date | null
|
|
71
72
|
totalCount: number | null
|
|
73
|
+
repositorySelection: string | null
|
|
72
74
|
lastError: string | null
|
|
73
75
|
attempts: number | null
|
|
74
76
|
nextAttemptAt: Date | null
|
|
@@ -90,6 +92,7 @@ export type GitHubRepoSnapshotCountAggregateOutputType = {
|
|
|
90
92
|
crawlStartedAt: number
|
|
91
93
|
completedAt: number
|
|
92
94
|
totalCount: number
|
|
95
|
+
repositorySelection: number
|
|
93
96
|
lastError: number
|
|
94
97
|
attempts: number
|
|
95
98
|
nextAttemptAt: number
|
|
@@ -125,6 +128,7 @@ export type GitHubRepoSnapshotMinAggregateInputType = {
|
|
|
125
128
|
crawlStartedAt?: true
|
|
126
129
|
completedAt?: true
|
|
127
130
|
totalCount?: true
|
|
131
|
+
repositorySelection?: true
|
|
128
132
|
lastError?: true
|
|
129
133
|
attempts?: true
|
|
130
134
|
nextAttemptAt?: true
|
|
@@ -146,6 +150,7 @@ export type GitHubRepoSnapshotMaxAggregateInputType = {
|
|
|
146
150
|
crawlStartedAt?: true
|
|
147
151
|
completedAt?: true
|
|
148
152
|
totalCount?: true
|
|
153
|
+
repositorySelection?: true
|
|
149
154
|
lastError?: true
|
|
150
155
|
attempts?: true
|
|
151
156
|
nextAttemptAt?: true
|
|
@@ -167,6 +172,7 @@ export type GitHubRepoSnapshotCountAggregateInputType = {
|
|
|
167
172
|
crawlStartedAt?: true
|
|
168
173
|
completedAt?: true
|
|
169
174
|
totalCount?: true
|
|
175
|
+
repositorySelection?: true
|
|
170
176
|
lastError?: true
|
|
171
177
|
attempts?: true
|
|
172
178
|
nextAttemptAt?: true
|
|
@@ -275,6 +281,7 @@ export type GitHubRepoSnapshotGroupByOutputType = {
|
|
|
275
281
|
crawlStartedAt: Date | null
|
|
276
282
|
completedAt: Date | null
|
|
277
283
|
totalCount: number | null
|
|
284
|
+
repositorySelection: string | null
|
|
278
285
|
lastError: string | null
|
|
279
286
|
attempts: number
|
|
280
287
|
nextAttemptAt: Date | null
|
|
@@ -319,6 +326,7 @@ export type GitHubRepoSnapshotWhereInput = {
|
|
|
319
326
|
crawlStartedAt?: Prisma.DateTimeNullableFilter<"GitHubRepoSnapshot"> | Date | string | null
|
|
320
327
|
completedAt?: Prisma.DateTimeNullableFilter<"GitHubRepoSnapshot"> | Date | string | null
|
|
321
328
|
totalCount?: Prisma.IntNullableFilter<"GitHubRepoSnapshot"> | number | null
|
|
329
|
+
repositorySelection?: Prisma.StringNullableFilter<"GitHubRepoSnapshot"> | string | null
|
|
322
330
|
lastError?: Prisma.StringNullableFilter<"GitHubRepoSnapshot"> | string | null
|
|
323
331
|
attempts?: Prisma.IntFilter<"GitHubRepoSnapshot"> | number
|
|
324
332
|
nextAttemptAt?: Prisma.DateTimeNullableFilter<"GitHubRepoSnapshot"> | Date | string | null
|
|
@@ -341,6 +349,7 @@ export type GitHubRepoSnapshotOrderByWithRelationInput = {
|
|
|
341
349
|
crawlStartedAt?: Prisma.SortOrderInput | Prisma.SortOrder
|
|
342
350
|
completedAt?: Prisma.SortOrderInput | Prisma.SortOrder
|
|
343
351
|
totalCount?: Prisma.SortOrderInput | Prisma.SortOrder
|
|
352
|
+
repositorySelection?: Prisma.SortOrderInput | Prisma.SortOrder
|
|
344
353
|
lastError?: Prisma.SortOrderInput | Prisma.SortOrder
|
|
345
354
|
attempts?: Prisma.SortOrder
|
|
346
355
|
nextAttemptAt?: Prisma.SortOrderInput | Prisma.SortOrder
|
|
@@ -367,6 +376,7 @@ export type GitHubRepoSnapshotWhereUniqueInput = Prisma.AtLeast<{
|
|
|
367
376
|
crawlStartedAt?: Prisma.DateTimeNullableFilter<"GitHubRepoSnapshot"> | Date | string | null
|
|
368
377
|
completedAt?: Prisma.DateTimeNullableFilter<"GitHubRepoSnapshot"> | Date | string | null
|
|
369
378
|
totalCount?: Prisma.IntNullableFilter<"GitHubRepoSnapshot"> | number | null
|
|
379
|
+
repositorySelection?: Prisma.StringNullableFilter<"GitHubRepoSnapshot"> | string | null
|
|
370
380
|
lastError?: Prisma.StringNullableFilter<"GitHubRepoSnapshot"> | string | null
|
|
371
381
|
attempts?: Prisma.IntFilter<"GitHubRepoSnapshot"> | number
|
|
372
382
|
nextAttemptAt?: Prisma.DateTimeNullableFilter<"GitHubRepoSnapshot"> | Date | string | null
|
|
@@ -389,6 +399,7 @@ export type GitHubRepoSnapshotOrderByWithAggregationInput = {
|
|
|
389
399
|
crawlStartedAt?: Prisma.SortOrderInput | Prisma.SortOrder
|
|
390
400
|
completedAt?: Prisma.SortOrderInput | Prisma.SortOrder
|
|
391
401
|
totalCount?: Prisma.SortOrderInput | Prisma.SortOrder
|
|
402
|
+
repositorySelection?: Prisma.SortOrderInput | Prisma.SortOrder
|
|
392
403
|
lastError?: Prisma.SortOrderInput | Prisma.SortOrder
|
|
393
404
|
attempts?: Prisma.SortOrder
|
|
394
405
|
nextAttemptAt?: Prisma.SortOrderInput | Prisma.SortOrder
|
|
@@ -418,6 +429,7 @@ export type GitHubRepoSnapshotScalarWhereWithAggregatesInput = {
|
|
|
418
429
|
crawlStartedAt?: Prisma.DateTimeNullableWithAggregatesFilter<"GitHubRepoSnapshot"> | Date | string | null
|
|
419
430
|
completedAt?: Prisma.DateTimeNullableWithAggregatesFilter<"GitHubRepoSnapshot"> | Date | string | null
|
|
420
431
|
totalCount?: Prisma.IntNullableWithAggregatesFilter<"GitHubRepoSnapshot"> | number | null
|
|
432
|
+
repositorySelection?: Prisma.StringNullableWithAggregatesFilter<"GitHubRepoSnapshot"> | string | null
|
|
421
433
|
lastError?: Prisma.StringNullableWithAggregatesFilter<"GitHubRepoSnapshot"> | string | null
|
|
422
434
|
attempts?: Prisma.IntWithAggregatesFilter<"GitHubRepoSnapshot"> | number
|
|
423
435
|
nextAttemptAt?: Prisma.DateTimeNullableWithAggregatesFilter<"GitHubRepoSnapshot"> | Date | string | null
|
|
@@ -439,6 +451,7 @@ export type GitHubRepoSnapshotCreateInput = {
|
|
|
439
451
|
crawlStartedAt?: Date | string | null
|
|
440
452
|
completedAt?: Date | string | null
|
|
441
453
|
totalCount?: number | null
|
|
454
|
+
repositorySelection?: string | null
|
|
442
455
|
lastError?: string | null
|
|
443
456
|
attempts?: number
|
|
444
457
|
nextAttemptAt?: Date | string | null
|
|
@@ -461,6 +474,7 @@ export type GitHubRepoSnapshotUncheckedCreateInput = {
|
|
|
461
474
|
crawlStartedAt?: Date | string | null
|
|
462
475
|
completedAt?: Date | string | null
|
|
463
476
|
totalCount?: number | null
|
|
477
|
+
repositorySelection?: string | null
|
|
464
478
|
lastError?: string | null
|
|
465
479
|
attempts?: number
|
|
466
480
|
nextAttemptAt?: Date | string | null
|
|
@@ -483,6 +497,7 @@ export type GitHubRepoSnapshotUpdateInput = {
|
|
|
483
497
|
crawlStartedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
|
484
498
|
completedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
|
485
499
|
totalCount?: Prisma.NullableIntFieldUpdateOperationsInput | number | null
|
|
500
|
+
repositorySelection?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
|
486
501
|
lastError?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
|
487
502
|
attempts?: Prisma.IntFieldUpdateOperationsInput | number
|
|
488
503
|
nextAttemptAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
|
@@ -505,6 +520,7 @@ export type GitHubRepoSnapshotUncheckedUpdateInput = {
|
|
|
505
520
|
crawlStartedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
|
506
521
|
completedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
|
507
522
|
totalCount?: Prisma.NullableIntFieldUpdateOperationsInput | number | null
|
|
523
|
+
repositorySelection?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
|
508
524
|
lastError?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
|
509
525
|
attempts?: Prisma.IntFieldUpdateOperationsInput | number
|
|
510
526
|
nextAttemptAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
|
@@ -527,6 +543,7 @@ export type GitHubRepoSnapshotCreateManyInput = {
|
|
|
527
543
|
crawlStartedAt?: Date | string | null
|
|
528
544
|
completedAt?: Date | string | null
|
|
529
545
|
totalCount?: number | null
|
|
546
|
+
repositorySelection?: string | null
|
|
530
547
|
lastError?: string | null
|
|
531
548
|
attempts?: number
|
|
532
549
|
nextAttemptAt?: Date | string | null
|
|
@@ -548,6 +565,7 @@ export type GitHubRepoSnapshotUpdateManyMutationInput = {
|
|
|
548
565
|
crawlStartedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
|
549
566
|
completedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
|
550
567
|
totalCount?: Prisma.NullableIntFieldUpdateOperationsInput | number | null
|
|
568
|
+
repositorySelection?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
|
551
569
|
lastError?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
|
552
570
|
attempts?: Prisma.IntFieldUpdateOperationsInput | number
|
|
553
571
|
nextAttemptAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
|
@@ -569,6 +587,7 @@ export type GitHubRepoSnapshotUncheckedUpdateManyInput = {
|
|
|
569
587
|
crawlStartedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
|
570
588
|
completedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
|
571
589
|
totalCount?: Prisma.NullableIntFieldUpdateOperationsInput | number | null
|
|
590
|
+
repositorySelection?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
|
572
591
|
lastError?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
|
573
592
|
attempts?: Prisma.IntFieldUpdateOperationsInput | number
|
|
574
593
|
nextAttemptAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
|
@@ -597,6 +616,7 @@ export type GitHubRepoSnapshotCountOrderByAggregateInput = {
|
|
|
597
616
|
crawlStartedAt?: Prisma.SortOrder
|
|
598
617
|
completedAt?: Prisma.SortOrder
|
|
599
618
|
totalCount?: Prisma.SortOrder
|
|
619
|
+
repositorySelection?: Prisma.SortOrder
|
|
600
620
|
lastError?: Prisma.SortOrder
|
|
601
621
|
attempts?: Prisma.SortOrder
|
|
602
622
|
nextAttemptAt?: Prisma.SortOrder
|
|
@@ -624,6 +644,7 @@ export type GitHubRepoSnapshotMaxOrderByAggregateInput = {
|
|
|
624
644
|
crawlStartedAt?: Prisma.SortOrder
|
|
625
645
|
completedAt?: Prisma.SortOrder
|
|
626
646
|
totalCount?: Prisma.SortOrder
|
|
647
|
+
repositorySelection?: Prisma.SortOrder
|
|
627
648
|
lastError?: Prisma.SortOrder
|
|
628
649
|
attempts?: Prisma.SortOrder
|
|
629
650
|
nextAttemptAt?: Prisma.SortOrder
|
|
@@ -645,6 +666,7 @@ export type GitHubRepoSnapshotMinOrderByAggregateInput = {
|
|
|
645
666
|
crawlStartedAt?: Prisma.SortOrder
|
|
646
667
|
completedAt?: Prisma.SortOrder
|
|
647
668
|
totalCount?: Prisma.SortOrder
|
|
669
|
+
repositorySelection?: Prisma.SortOrder
|
|
648
670
|
lastError?: Prisma.SortOrder
|
|
649
671
|
attempts?: Prisma.SortOrder
|
|
650
672
|
nextAttemptAt?: Prisma.SortOrder
|
|
@@ -691,6 +713,7 @@ export type GitHubRepoSnapshotCreateWithoutReposInput = {
|
|
|
691
713
|
crawlStartedAt?: Date | string | null
|
|
692
714
|
completedAt?: Date | string | null
|
|
693
715
|
totalCount?: number | null
|
|
716
|
+
repositorySelection?: string | null
|
|
694
717
|
lastError?: string | null
|
|
695
718
|
attempts?: number
|
|
696
719
|
nextAttemptAt?: Date | string | null
|
|
@@ -712,6 +735,7 @@ export type GitHubRepoSnapshotUncheckedCreateWithoutReposInput = {
|
|
|
712
735
|
crawlStartedAt?: Date | string | null
|
|
713
736
|
completedAt?: Date | string | null
|
|
714
737
|
totalCount?: number | null
|
|
738
|
+
repositorySelection?: string | null
|
|
715
739
|
lastError?: string | null
|
|
716
740
|
attempts?: number
|
|
717
741
|
nextAttemptAt?: Date | string | null
|
|
@@ -749,6 +773,7 @@ export type GitHubRepoSnapshotUpdateWithoutReposInput = {
|
|
|
749
773
|
crawlStartedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
|
750
774
|
completedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
|
751
775
|
totalCount?: Prisma.NullableIntFieldUpdateOperationsInput | number | null
|
|
776
|
+
repositorySelection?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
|
752
777
|
lastError?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
|
753
778
|
attempts?: Prisma.IntFieldUpdateOperationsInput | number
|
|
754
779
|
nextAttemptAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
|
@@ -770,6 +795,7 @@ export type GitHubRepoSnapshotUncheckedUpdateWithoutReposInput = {
|
|
|
770
795
|
crawlStartedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
|
771
796
|
completedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
|
772
797
|
totalCount?: Prisma.NullableIntFieldUpdateOperationsInput | number | null
|
|
798
|
+
repositorySelection?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
|
773
799
|
lastError?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
|
774
800
|
attempts?: Prisma.IntFieldUpdateOperationsInput | number
|
|
775
801
|
nextAttemptAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
|
@@ -822,6 +848,7 @@ export type GitHubRepoSnapshotSelect<ExtArgs extends runtime.Types.Extensions.In
|
|
|
822
848
|
crawlStartedAt?: boolean
|
|
823
849
|
completedAt?: boolean
|
|
824
850
|
totalCount?: boolean
|
|
851
|
+
repositorySelection?: boolean
|
|
825
852
|
lastError?: boolean
|
|
826
853
|
attempts?: boolean
|
|
827
854
|
nextAttemptAt?: boolean
|
|
@@ -845,6 +872,7 @@ export type GitHubRepoSnapshotSelectCreateManyAndReturn<ExtArgs extends runtime.
|
|
|
845
872
|
crawlStartedAt?: boolean
|
|
846
873
|
completedAt?: boolean
|
|
847
874
|
totalCount?: boolean
|
|
875
|
+
repositorySelection?: boolean
|
|
848
876
|
lastError?: boolean
|
|
849
877
|
attempts?: boolean
|
|
850
878
|
nextAttemptAt?: boolean
|
|
@@ -866,6 +894,7 @@ export type GitHubRepoSnapshotSelectUpdateManyAndReturn<ExtArgs extends runtime.
|
|
|
866
894
|
crawlStartedAt?: boolean
|
|
867
895
|
completedAt?: boolean
|
|
868
896
|
totalCount?: boolean
|
|
897
|
+
repositorySelection?: boolean
|
|
869
898
|
lastError?: boolean
|
|
870
899
|
attempts?: boolean
|
|
871
900
|
nextAttemptAt?: boolean
|
|
@@ -887,6 +916,7 @@ export type GitHubRepoSnapshotSelectScalar = {
|
|
|
887
916
|
crawlStartedAt?: boolean
|
|
888
917
|
completedAt?: boolean
|
|
889
918
|
totalCount?: boolean
|
|
919
|
+
repositorySelection?: boolean
|
|
890
920
|
lastError?: boolean
|
|
891
921
|
attempts?: boolean
|
|
892
922
|
nextAttemptAt?: boolean
|
|
@@ -898,7 +928,7 @@ export type GitHubRepoSnapshotSelectScalar = {
|
|
|
898
928
|
updatedAt?: boolean
|
|
899
929
|
}
|
|
900
930
|
|
|
901
|
-
export type GitHubRepoSnapshotOmit<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetOmit<"id" | "accountId" | "appKind" | "appRef" | "org" | "crawlPage" | "crawlStartedAt" | "completedAt" | "totalCount" | "lastError" | "attempts" | "nextAttemptAt" | "rateLimitResetAt" | "leaseHolder" | "leasedUntil" | "lastTickAt" | "createdAt" | "updatedAt", ExtArgs["result"]["gitHubRepoSnapshot"]>
|
|
931
|
+
export type GitHubRepoSnapshotOmit<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetOmit<"id" | "accountId" | "appKind" | "appRef" | "org" | "crawlPage" | "crawlStartedAt" | "completedAt" | "totalCount" | "repositorySelection" | "lastError" | "attempts" | "nextAttemptAt" | "rateLimitResetAt" | "leaseHolder" | "leasedUntil" | "lastTickAt" | "createdAt" | "updatedAt", ExtArgs["result"]["gitHubRepoSnapshot"]>
|
|
902
932
|
export type GitHubRepoSnapshotInclude<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
|
|
903
933
|
repos?: boolean | Prisma.GitHubRepoSnapshot$reposArgs<ExtArgs>
|
|
904
934
|
_count?: boolean | Prisma.GitHubRepoSnapshotCountOutputTypeDefaultArgs<ExtArgs>
|
|
@@ -921,6 +951,7 @@ export type $GitHubRepoSnapshotPayload<ExtArgs extends runtime.Types.Extensions.
|
|
|
921
951
|
crawlStartedAt: Date | null
|
|
922
952
|
completedAt: Date | null
|
|
923
953
|
totalCount: number | null
|
|
954
|
+
repositorySelection: string | null
|
|
924
955
|
lastError: string | null
|
|
925
956
|
attempts: number
|
|
926
957
|
nextAttemptAt: Date | null
|
|
@@ -1363,6 +1394,7 @@ export interface GitHubRepoSnapshotFieldRefs {
|
|
|
1363
1394
|
readonly crawlStartedAt: Prisma.FieldRef<"GitHubRepoSnapshot", 'DateTime'>
|
|
1364
1395
|
readonly completedAt: Prisma.FieldRef<"GitHubRepoSnapshot", 'DateTime'>
|
|
1365
1396
|
readonly totalCount: Prisma.FieldRef<"GitHubRepoSnapshot", 'Int'>
|
|
1397
|
+
readonly repositorySelection: Prisma.FieldRef<"GitHubRepoSnapshot", 'String'>
|
|
1366
1398
|
readonly lastError: Prisma.FieldRef<"GitHubRepoSnapshot", 'String'>
|
|
1367
1399
|
readonly attempts: Prisma.FieldRef<"GitHubRepoSnapshot", 'Int'>
|
|
1368
1400
|
readonly nextAttemptAt: Prisma.FieldRef<"GitHubRepoSnapshot", 'DateTime'>
|
|
@@ -761,6 +761,8 @@ model GitHubRepoSnapshot {
|
|
|
761
761
|
crawlStartedAt DateTime?
|
|
762
762
|
completedAt DateTime?
|
|
763
763
|
totalCount Int?
|
|
764
|
+
// Agent App installation on the org: 'all' | 'selected'; null = unknown (never treated as 'all')
|
|
765
|
+
repositorySelection String?
|
|
764
766
|
lastError String?
|
|
765
767
|
attempts Int @default(0)
|
|
766
768
|
nextAttemptAt DateTime?
|
|
@@ -7,6 +7,11 @@
|
|
|
7
7
|
* repo names and levels only (no token or key ever reaches this module).
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
+
import {
|
|
11
|
+
type GithubAppsState,
|
|
12
|
+
LOOKUP_MISSING_REASON,
|
|
13
|
+
LOOKUP_ONLY_REASON,
|
|
14
|
+
} from "./github-apps-state.ts";
|
|
10
15
|
import type { GheOrgs } from "./admin-ui-github-enterprise-pages.ts";
|
|
11
16
|
import { escapeHtml } from "./admin-ui-styles.ts";
|
|
12
17
|
|
|
@@ -117,7 +122,7 @@ export function renderGithubAccessResult(
|
|
|
117
122
|
preview: GithubAccessPreviewView,
|
|
118
123
|
): string {
|
|
119
124
|
if (preview.status === "unconfigured") {
|
|
120
|
-
return `<div class="alert alert-warning"
|
|
125
|
+
return `<div class="alert alert-warning" data-reason="lookup-missing">${escapeHtml(LOOKUP_MISSING_REASON)}</div>`;
|
|
121
126
|
}
|
|
122
127
|
const access = preview.access;
|
|
123
128
|
if (
|
|
@@ -169,8 +174,21 @@ export function renderGithubAccessError(message: string): string {
|
|
|
169
174
|
return `<div class="alert alert-error">${escapeHtml(message)}</div>`;
|
|
170
175
|
}
|
|
171
176
|
|
|
172
|
-
/**
|
|
173
|
-
|
|
177
|
+
/**
|
|
178
|
+
* "Install on org" block (GHC-1.2); lazy-loads the org list fragment on page
|
|
179
|
+
* load. In lookup-only it explains that installing needs an installer App
|
|
180
|
+
* instead of loading the (installer-backed) org list.
|
|
181
|
+
*/
|
|
182
|
+
export function renderGithubInstallCard(
|
|
183
|
+
agentId: string,
|
|
184
|
+
appsState: GithubAppsState = "both",
|
|
185
|
+
): string {
|
|
186
|
+
if (appsState === "lookup_only") {
|
|
187
|
+
return `<div id="github-install-card" style="margin-top:20px">
|
|
188
|
+
<div class="form-label" style="font-weight:600;margin-bottom:6px">Install on org</div>
|
|
189
|
+
<div class="alert alert-warning" data-reason="lookup-only">${escapeHtml(LOOKUP_ONLY_REASON)}</div>
|
|
190
|
+
</div>`;
|
|
191
|
+
}
|
|
174
192
|
const url = `/admin/agents/${escapeHtml(agentId)}/github-orgs`;
|
|
175
193
|
return `<div id="github-install-card" style="margin-top:20px">
|
|
176
194
|
<div class="form-label" style="font-weight:600;margin-bottom:6px">Install on org</div>
|
|
@@ -202,7 +220,7 @@ export function renderGithubOrgsFragment(
|
|
|
202
220
|
data: GheOrgs,
|
|
203
221
|
): string {
|
|
204
222
|
if (!data.configured) {
|
|
205
|
-
return `<div class="alert alert-warning">The installer GitHub App is not configured.</div>`;
|
|
223
|
+
return `<div class="alert alert-warning" data-reason="installer-unconfigured">The installer GitHub App is not configured. Installing the agent App on an organization needs an enterprise installer App (GitHub Enterprise Cloud).</div>`;
|
|
206
224
|
}
|
|
207
225
|
const reason = data.agentAppReason
|
|
208
226
|
? `<div class="alert alert-error">${escapeHtml(data.agentAppReason)}</div>`
|
|
@@ -330,3 +330,90 @@ describe("Install on org block (GHC-1.2)", () => {
|
|
|
330
330
|
);
|
|
331
331
|
});
|
|
332
332
|
});
|
|
333
|
+
|
|
334
|
+
describe("GitHub identity surfaces by App state (GFU-2.2)", () => {
|
|
335
|
+
const pageState = (appsState?: "both" | "lookup_only" | "lookup_missing") =>
|
|
336
|
+
renderAgentDetailPage(
|
|
337
|
+
{ ...AGENT, githubUsername: "octo" },
|
|
338
|
+
{ GH_APP_ID: "1" },
|
|
339
|
+
[],
|
|
340
|
+
[],
|
|
341
|
+
[],
|
|
342
|
+
[],
|
|
343
|
+
[],
|
|
344
|
+
"u@x.com",
|
|
345
|
+
true,
|
|
346
|
+
{ timezone: "UTC", ...(appsState ? { githubAppsState: appsState } : {}) },
|
|
347
|
+
);
|
|
348
|
+
|
|
349
|
+
test("both: preview, sync button and the install org list", () => {
|
|
350
|
+
const html = pageState("both");
|
|
351
|
+
expect(html).toContain('id="github-access-btn"');
|
|
352
|
+
expect(html).toContain('id="github-sync-btn"');
|
|
353
|
+
expect(html).toContain('id="github-install-result"');
|
|
354
|
+
expect(html).not.toContain('data-reason="lookup-only"');
|
|
355
|
+
});
|
|
356
|
+
|
|
357
|
+
test("lookup-only: preview stays, Sync and Install explain the installer need", () => {
|
|
358
|
+
const html = pageState("lookup_only");
|
|
359
|
+
expect(html).toContain('id="github-access-btn"');
|
|
360
|
+
expect(html).toContain('data-reason="lookup-only"');
|
|
361
|
+
expect(html).not.toContain('id="github-sync-btn"');
|
|
362
|
+
expect(html).not.toContain('id="github-install-result"');
|
|
363
|
+
expect(html).toContain("Install on org");
|
|
364
|
+
});
|
|
365
|
+
|
|
366
|
+
test("lookup-missing: only the Sync card, saying the lookup App is missing", () => {
|
|
367
|
+
const html = pageState("lookup_missing");
|
|
368
|
+
expect(html).toContain('data-reason="lookup-missing"');
|
|
369
|
+
expect(html).not.toContain('id="github-access-btn"');
|
|
370
|
+
expect(html).not.toContain("Install on org");
|
|
371
|
+
});
|
|
372
|
+
|
|
373
|
+
test("no state: hidden; legacy githubEnterpriseConfigured: true means both", () => {
|
|
374
|
+
expect(pageState()).not.toContain('id="github-installation-card"');
|
|
375
|
+
expect(page(true, true)).toContain('id="github-installation-card"');
|
|
376
|
+
expect(page(true, true)).not.toContain('data-reason="lookup-only"');
|
|
377
|
+
});
|
|
378
|
+
|
|
379
|
+
test("access preview: unconfigured is the lookup-missing message", () => {
|
|
380
|
+
const html = renderGithubAccessResult({ status: "unconfigured" });
|
|
381
|
+
expect(html).toContain('data-reason="lookup-missing"');
|
|
382
|
+
expect(html).toContain("lookup GitHub App is not configured");
|
|
383
|
+
expect(html).not.toContain("installer");
|
|
384
|
+
});
|
|
385
|
+
|
|
386
|
+
test("access preview: escapes the username and org values", () => {
|
|
387
|
+
const html = renderGithubAccessResult({
|
|
388
|
+
status: "user_not_found",
|
|
389
|
+
access: {
|
|
390
|
+
username: "<img src=x>",
|
|
391
|
+
outcome: "user_not_found",
|
|
392
|
+
userVerified: false,
|
|
393
|
+
orgs: [],
|
|
394
|
+
unresolved: 0,
|
|
395
|
+
complete: true,
|
|
396
|
+
checkedAt: "2026-11-10T00:00:00Z",
|
|
397
|
+
},
|
|
398
|
+
} as GithubAccessPreviewView);
|
|
399
|
+
expect(html).not.toContain("<img src=x>");
|
|
400
|
+
expect(html).toContain("<img src=x>");
|
|
401
|
+
});
|
|
402
|
+
|
|
403
|
+
test("install card: lookup-only explains; both lazy-loads; id escaped", () => {
|
|
404
|
+
const only = renderGithubInstallCard('a"><i>', "lookup_only");
|
|
405
|
+
expect(only).toContain('data-reason="lookup-only"');
|
|
406
|
+
expect(only).not.toContain("github-install-result");
|
|
407
|
+
expect(only).not.toContain("<i>");
|
|
408
|
+
expect(renderGithubInstallCard("a", "both")).toBe(
|
|
409
|
+
renderGithubInstallCard("a"),
|
|
410
|
+
);
|
|
411
|
+
});
|
|
412
|
+
|
|
413
|
+
test("orgs fragment: installer-unconfigured names the installer and its enterprise need", () => {
|
|
414
|
+
const html = renderGithubOrgsFragment("a", { configured: false, orgs: [] });
|
|
415
|
+
expect(html).toContain("The installer GitHub App is not configured.");
|
|
416
|
+
expect(html).toContain("enterprise installer App");
|
|
417
|
+
expect(html).not.toContain("lookup");
|
|
418
|
+
});
|
|
419
|
+
});
|
|
@@ -13,6 +13,11 @@
|
|
|
13
13
|
|
|
14
14
|
import type { components } from "@app-vitals/agent-lib/admin-types";
|
|
15
15
|
import { escapeHtml } from "./admin-ui-styles.ts";
|
|
16
|
+
import {
|
|
17
|
+
type GithubAppsState,
|
|
18
|
+
LOOKUP_MISSING_REASON,
|
|
19
|
+
LOOKUP_ONLY_REASON,
|
|
20
|
+
} from "./github-apps-state.ts";
|
|
16
21
|
import {
|
|
17
22
|
MAX_UNCONFIRMED_REMOVALS,
|
|
18
23
|
MISSING_APP_ID_REASON,
|
|
@@ -199,6 +204,7 @@ export const APP_ID_MISMATCH_MESSAGE =
|
|
|
199
204
|
export interface GithubSyncPreviewView {
|
|
200
205
|
status: "previewed" | "skipped";
|
|
201
206
|
reason?: string;
|
|
207
|
+
appsState?: "lookup_only" | "lookup_missing";
|
|
202
208
|
appAdds?: string[];
|
|
203
209
|
appRemoves?: string[];
|
|
204
210
|
agentRemoves?: string[];
|
|
@@ -211,6 +217,7 @@ export interface GithubSyncPreviewView {
|
|
|
211
217
|
export interface GithubSyncApplyView {
|
|
212
218
|
status: "applied" | "noop" | "skipped";
|
|
213
219
|
reason?: string;
|
|
220
|
+
appsState?: "lookup_only" | "lookup_missing";
|
|
214
221
|
appAdds?: string[];
|
|
215
222
|
appRemoves?: string[];
|
|
216
223
|
agentRemoves?: string[];
|
|
@@ -223,6 +230,12 @@ export interface GithubSyncCardState {
|
|
|
223
230
|
/** The agent has a GH_APP_ID in its env. */
|
|
224
231
|
hasAppId: boolean;
|
|
225
232
|
githubUsername?: string | null;
|
|
233
|
+
/**
|
|
234
|
+
* Which enterprise Apps are configured. Default "both" (today's card).
|
|
235
|
+
* "lookup_only" explains that Sync needs an installer App; "lookup_missing"
|
|
236
|
+
* says the lookup App is missing. Neither loads installer-backed data.
|
|
237
|
+
*/
|
|
238
|
+
appsState?: GithubAppsState;
|
|
226
239
|
}
|
|
227
240
|
|
|
228
241
|
/**
|
|
@@ -236,18 +249,27 @@ export function renderGithubSyncCard(
|
|
|
236
249
|
): string {
|
|
237
250
|
const id = escapeHtml(agentId);
|
|
238
251
|
const base = `/admin/agents/${id}/github-installation`;
|
|
252
|
+
const appsState = state.appsState ?? "both";
|
|
239
253
|
let action: string;
|
|
240
|
-
if (
|
|
254
|
+
if (appsState === "lookup_only") {
|
|
255
|
+
action = `<div class="alert alert-warning" data-reason="lookup-only">${escapeHtml(LOOKUP_ONLY_REASON)}</div>`;
|
|
256
|
+
} else if (appsState === "lookup_missing") {
|
|
257
|
+
action = `<div class="alert alert-warning" data-reason="lookup-missing">${escapeHtml(LOOKUP_MISSING_REASON)}</div>`;
|
|
258
|
+
} else if (!state.hasAppId) {
|
|
241
259
|
action = `<div class="alert alert-warning" data-reason="missing-app-id">${escapeHtml(MISSING_APP_ID_REASON)}</div>`;
|
|
242
260
|
} else if (!state.githubUsername?.trim()) {
|
|
243
261
|
action = `<div class="alert alert-warning" data-reason="no-username">${escapeHtml(NO_USERNAME_REASON)}</div>`;
|
|
244
262
|
} else {
|
|
245
263
|
action = `<button type="button" class="btn btn-primary" id="github-sync-btn" data-url="/admin/agents/${id}/github-sync/confirm">Sync</button><div id="github-sync-confirm" style="margin-top:12px"></div>`;
|
|
246
264
|
}
|
|
247
|
-
const loader =
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
265
|
+
const loader =
|
|
266
|
+
state.hasAppId && appsState === "both"
|
|
267
|
+
? `<div id="github-installation-body">Loading...</div>`
|
|
268
|
+
: "";
|
|
269
|
+
const refresh =
|
|
270
|
+
appsState === "lookup_missing"
|
|
271
|
+
? ""
|
|
272
|
+
: `<div style="margin:0 0 12px"><button type="button" class="btn btn-secondary" id="github-refresh-btn" data-url="/admin/agents/${id}/github-cache/refresh">Refresh</button> <span style="color:#6b7280;font-size:12px">Re-reads the cached repo lists in the background. Reload the page to see progress.</span></div>`;
|
|
251
273
|
return `<div id="github-installation-card" data-base-url="${base}" style="margin-top:20px">
|
|
252
274
|
<div class="form-label" style="font-weight:600;margin-bottom:6px">GitHub sync</div>
|
|
253
275
|
<p style="color:#6b7280;font-size:12px;margin:0 0 12px">Brings this agent's App installation and its repos in line with what the bound GitHub user can push to.</p>
|
|
@@ -517,7 +539,7 @@ export function renderSyncConfirm(
|
|
|
517
539
|
timezone?: string,
|
|
518
540
|
): string {
|
|
519
541
|
if (preview.status === "skipped") {
|
|
520
|
-
return `<div class="alert alert-warning" data-sync="skipped">Sync was skipped: ${escapeHtml(preview.reason ?? "unknown reason")}</div>`;
|
|
542
|
+
return `<div class="alert alert-warning" data-sync="skipped"${preview.appsState ? ` data-apps-state="${escapeHtml(preview.appsState)}"` : ""}>Sync was skipped: ${escapeHtml(preview.reason ?? "unknown reason")}</div>`;
|
|
521
543
|
}
|
|
522
544
|
const appAdds = preview.appAdds ?? [];
|
|
523
545
|
const appRemoves = preview.appRemoves ?? [];
|
|
@@ -556,7 +578,7 @@ export function renderSyncResult(
|
|
|
556
578
|
timezone?: string,
|
|
557
579
|
): string {
|
|
558
580
|
if (result.status === "skipped") {
|
|
559
|
-
return `<div class="alert alert-warning" data-sync="skipped">Sync was skipped: ${escapeHtml(result.reason ?? "unknown reason")}</div>`;
|
|
581
|
+
return `<div class="alert alert-warning" data-sync="skipped"${result.appsState ? ` data-apps-state="${escapeHtml(result.appsState)}"` : ""}>Sync was skipped: ${escapeHtml(result.reason ?? "unknown reason")}</div>`;
|
|
560
582
|
}
|
|
561
583
|
if (result.status === "noop") {
|
|
562
584
|
const skippedList = result.skippedOrgs ?? [];
|
|
@@ -17,6 +17,10 @@ import {
|
|
|
17
17
|
renderSyncResult,
|
|
18
18
|
uncoveredRepos,
|
|
19
19
|
} from "./admin-ui-installation-repos-pages.ts";
|
|
20
|
+
import {
|
|
21
|
+
LOOKUP_MISSING_REASON,
|
|
22
|
+
LOOKUP_ONLY_REASON,
|
|
23
|
+
} from "./github-apps-state.ts";
|
|
20
24
|
import { MISSING_APP_ID_REASON } from "./installation-ports.ts";
|
|
21
25
|
|
|
22
26
|
describe("uncoveredRepos", () => {
|
|
@@ -570,3 +574,82 @@ describe("installation sync timestamps in the admin timezone", () => {
|
|
|
570
574
|
expect(html).toContain("Oldest check Jul 1, 12:00 PM PDT");
|
|
571
575
|
});
|
|
572
576
|
});
|
|
577
|
+
|
|
578
|
+
describe("renderGithubSyncCard: App states (GFU-2.2)", () => {
|
|
579
|
+
const base = { hasAppId: true, githubUsername: "octo" };
|
|
580
|
+
|
|
581
|
+
it("both (explicit or default) renders identically", () => {
|
|
582
|
+
expect(renderGithubSyncCard("a1", { ...base, appsState: "both" })).toBe(
|
|
583
|
+
renderGithubSyncCard("a1", base),
|
|
584
|
+
);
|
|
585
|
+
});
|
|
586
|
+
|
|
587
|
+
it("lookup-only explains that Sync needs an installer; no button, body or form", () => {
|
|
588
|
+
const html = renderGithubSyncCard("a1", {
|
|
589
|
+
...base,
|
|
590
|
+
appsState: "lookup_only",
|
|
591
|
+
});
|
|
592
|
+
expect(html).toContain('data-reason="lookup-only"');
|
|
593
|
+
expect(html).toContain("'");
|
|
594
|
+
expect(html).toContain(LOOKUP_ONLY_REASON.replace(/'/g, "'"));
|
|
595
|
+
expect(html).not.toContain('id="github-sync-btn"');
|
|
596
|
+
expect(html).not.toContain('id="github-installation-body"');
|
|
597
|
+
expect(html).toContain('id="github-refresh-btn"');
|
|
598
|
+
});
|
|
599
|
+
|
|
600
|
+
it("lookup-only wins over a missing App id or username", () => {
|
|
601
|
+
const html = renderGithubSyncCard("a1", {
|
|
602
|
+
hasAppId: false,
|
|
603
|
+
githubUsername: null,
|
|
604
|
+
appsState: "lookup_only",
|
|
605
|
+
});
|
|
606
|
+
expect(html).toContain('data-reason="lookup-only"');
|
|
607
|
+
expect(html).not.toContain('data-reason="missing-app-id"');
|
|
608
|
+
expect(html).not.toContain('data-reason="no-username"');
|
|
609
|
+
});
|
|
610
|
+
|
|
611
|
+
it("lookup-missing says the lookup App is missing, never the installer", () => {
|
|
612
|
+
const html = renderGithubSyncCard("a1", {
|
|
613
|
+
...base,
|
|
614
|
+
appsState: "lookup_missing",
|
|
615
|
+
});
|
|
616
|
+
expect(html).toContain('data-reason="lookup-missing"');
|
|
617
|
+
expect(html).toContain(LOOKUP_MISSING_REASON);
|
|
618
|
+
expect(html).not.toContain("installer");
|
|
619
|
+
expect(html).not.toContain('id="github-sync-btn"');
|
|
620
|
+
expect(html).not.toContain('id="github-refresh-btn"');
|
|
621
|
+
});
|
|
622
|
+
|
|
623
|
+
it("escapes the agent id in every state", () => {
|
|
624
|
+
for (const appsState of [
|
|
625
|
+
"both",
|
|
626
|
+
"lookup_only",
|
|
627
|
+
"lookup_missing",
|
|
628
|
+
] as const) {
|
|
629
|
+
const html = renderGithubSyncCard('"><img src=x>', {
|
|
630
|
+
...base,
|
|
631
|
+
appsState,
|
|
632
|
+
});
|
|
633
|
+
expect(html).not.toContain("<img src=x>");
|
|
634
|
+
}
|
|
635
|
+
});
|
|
636
|
+
|
|
637
|
+
it("sync skipped fragments carry an escaped apps-state marker and reason", () => {
|
|
638
|
+
const skipped = {
|
|
639
|
+
status: "skipped" as const,
|
|
640
|
+
appsState: "lookup_only" as const,
|
|
641
|
+
reason: "<b>no installer</b>",
|
|
642
|
+
};
|
|
643
|
+
for (const html of [
|
|
644
|
+
renderSyncConfirm("a1", skipped),
|
|
645
|
+
renderSyncResult(skipped, []),
|
|
646
|
+
]) {
|
|
647
|
+
expect(html).toContain('data-apps-state="lookup_only"');
|
|
648
|
+
expect(html).toContain("<b>no installer</b>");
|
|
649
|
+
expect(html).not.toContain("<b>no installer</b>");
|
|
650
|
+
}
|
|
651
|
+
expect(
|
|
652
|
+
renderSyncResult({ status: "skipped", reason: "r" }, []),
|
|
653
|
+
).not.toContain("data-apps-state");
|
|
654
|
+
});
|
|
655
|
+
});
|