@app-vitals/agent-lib 1.35.0 → 1.36.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.
Files changed (2) hide show
  1. package/admin-types.ts +44 -459
  2. package/package.json +1 -1
package/admin-types.ts CHANGED
@@ -3087,168 +3087,6 @@ export interface paths {
3087
3087
  patch?: never;
3088
3088
  trace?: never;
3089
3089
  };
3090
- "/agents/{id}/github-reconcile/plan": {
3091
- parameters: {
3092
- query?: never;
3093
- header?: never;
3094
- path?: never;
3095
- cookie?: never;
3096
- };
3097
- get?: never;
3098
- put?: never;
3099
- /**
3100
- * Plan a GitHub repo reconcile for the agent
3101
- * @description Platform-admin only (session members, ops keys and agent keys get 403). Read-only: nothing is persisted or changed. Returns the diff, warnings, `planHash` and the open work the removals would affect. 200 with `status: skipped` and a `reason` when no githubUsername is bound or the enterprise Apps are not configured. 404 for an unknown agent.
3102
- */
3103
- post: {
3104
- parameters: {
3105
- query?: never;
3106
- header?: never;
3107
- path: {
3108
- id: string;
3109
- };
3110
- cookie?: never;
3111
- };
3112
- requestBody?: {
3113
- content: {
3114
- "application/json": components["schemas"]["GithubReconcilePlanBody"];
3115
- };
3116
- };
3117
- responses: {
3118
- /** @description Reconcile plan */
3119
- 200: {
3120
- headers: {
3121
- [name: string]: unknown;
3122
- };
3123
- content: {
3124
- "application/json": components["schemas"]["GithubReconcilePlanResult"];
3125
- };
3126
- };
3127
- /** @description Unauthorized */
3128
- 401: {
3129
- headers: {
3130
- [name: string]: unknown;
3131
- };
3132
- content: {
3133
- "application/json": components["schemas"]["Error"];
3134
- };
3135
- };
3136
- /** @description Platform admin required */
3137
- 403: {
3138
- headers: {
3139
- [name: string]: unknown;
3140
- };
3141
- content: {
3142
- "application/json": components["schemas"]["Error"];
3143
- };
3144
- };
3145
- /** @description Agent not found */
3146
- 404: {
3147
- headers: {
3148
- [name: string]: unknown;
3149
- };
3150
- content: {
3151
- "application/json": components["schemas"]["Error"];
3152
- };
3153
- };
3154
- };
3155
- };
3156
- delete?: never;
3157
- options?: never;
3158
- head?: never;
3159
- patch?: never;
3160
- trace?: never;
3161
- };
3162
- "/agents/{id}/github-reconcile/apply": {
3163
- parameters: {
3164
- query?: never;
3165
- header?: never;
3166
- path?: never;
3167
- cookie?: never;
3168
- };
3169
- get?: never;
3170
- put?: never;
3171
- /**
3172
- * Apply a reviewed GitHub repo reconcile plan
3173
- * @description Platform-admin only (session members, ops keys and agent keys get 403). Re-plans server-side and applies only when the fresh plan still matches `planHash` (409 otherwise). More than 10 removals need `confirmRemovals: true` (422 otherwise). Returns the audit id and result. 200 with `status: skipped` (unbound user or unconfigured Apps) or `status: noop` (nothing to change) is not an error. Open work on removed repos is blocked through the optional open-work port; a failure there is a warning.
3174
- */
3175
- post: {
3176
- parameters: {
3177
- query?: never;
3178
- header?: never;
3179
- path: {
3180
- id: string;
3181
- };
3182
- cookie?: never;
3183
- };
3184
- requestBody: {
3185
- content: {
3186
- "application/json": components["schemas"]["GithubReconcileApplyBody"];
3187
- };
3188
- };
3189
- responses: {
3190
- /** @description Apply result */
3191
- 200: {
3192
- headers: {
3193
- [name: string]: unknown;
3194
- };
3195
- content: {
3196
- "application/json": components["schemas"]["GithubReconcileApplyResult"];
3197
- };
3198
- };
3199
- /** @description Unauthorized */
3200
- 401: {
3201
- headers: {
3202
- [name: string]: unknown;
3203
- };
3204
- content: {
3205
- "application/json": components["schemas"]["Error"];
3206
- };
3207
- };
3208
- /** @description Platform admin required */
3209
- 403: {
3210
- headers: {
3211
- [name: string]: unknown;
3212
- };
3213
- content: {
3214
- "application/json": components["schemas"]["Error"];
3215
- };
3216
- };
3217
- /** @description Agent not found */
3218
- 404: {
3219
- headers: {
3220
- [name: string]: unknown;
3221
- };
3222
- content: {
3223
- "application/json": components["schemas"]["Error"];
3224
- };
3225
- };
3226
- /** @description Plan hash is stale; re-plan */
3227
- 409: {
3228
- headers: {
3229
- [name: string]: unknown;
3230
- };
3231
- content: {
3232
- "application/json": components["schemas"]["Error"];
3233
- };
3234
- };
3235
- /** @description Removal cap needs confirmRemovals */
3236
- 422: {
3237
- headers: {
3238
- [name: string]: unknown;
3239
- };
3240
- content: {
3241
- "application/json": components["schemas"]["Error"];
3242
- };
3243
- };
3244
- };
3245
- };
3246
- delete?: never;
3247
- options?: never;
3248
- head?: never;
3249
- patch?: never;
3250
- trace?: never;
3251
- };
3252
3090
  "/agents/{id}/github-installation/repos": {
3253
3091
  parameters: {
3254
3092
  query?: never;
@@ -3337,214 +3175,14 @@ export interface paths {
3337
3175
  };
3338
3176
  };
3339
3177
  put?: never;
3340
- /**
3341
- * Add repos to the agent App's installation
3342
- * @description Platform-admin only. Grants the agent's own GitHub App installation access to the named repos, with no plan step; the agent's configured repos are not changed. Writes one audit entry (GitHubReconcileAudit, planHash `direct:add`) recording the caller and repos. 404 unknown agent; 422 no GH_APP_ID; 409 when the App is not installed on a repo's org (nothing is changed or audited); 502 when GitHub refuses (a failed audit entry is written).
3343
- */
3344
- post: {
3345
- parameters: {
3346
- query?: never;
3347
- header?: never;
3348
- path: {
3349
- id: string;
3350
- };
3351
- cookie?: never;
3352
- };
3353
- requestBody: {
3354
- content: {
3355
- "application/json": components["schemas"]["GithubInstallationReposBody"];
3356
- };
3357
- };
3358
- responses: {
3359
- /** @description Repos added */
3360
- 200: {
3361
- headers: {
3362
- [name: string]: unknown;
3363
- };
3364
- content: {
3365
- "application/json": components["schemas"]["GithubInstallationReposChange"];
3366
- };
3367
- };
3368
- /** @description Unauthorized */
3369
- 401: {
3370
- headers: {
3371
- [name: string]: unknown;
3372
- };
3373
- content: {
3374
- "application/json": components["schemas"]["Error"];
3375
- };
3376
- };
3377
- /** @description Platform admin required */
3378
- 403: {
3379
- headers: {
3380
- [name: string]: unknown;
3381
- };
3382
- content: {
3383
- "application/json": components["schemas"]["Error"];
3384
- };
3385
- };
3386
- /** @description Agent not found */
3387
- 404: {
3388
- headers: {
3389
- [name: string]: unknown;
3390
- };
3391
- content: {
3392
- "application/json": components["schemas"]["Error"];
3393
- };
3394
- };
3395
- /** @description Agent App not installed on the org */
3396
- 409: {
3397
- headers: {
3398
- [name: string]: unknown;
3399
- };
3400
- content: {
3401
- "application/json": components["schemas"]["Error"];
3402
- };
3403
- };
3404
- /** @description Agent has no GH_APP_ID (its own GitHub App is not set up) */
3405
- 422: {
3406
- headers: {
3407
- [name: string]: unknown;
3408
- };
3409
- content: {
3410
- "application/json": components["schemas"]["Error"];
3411
- };
3412
- };
3413
- /** @description GitHub unavailable or refused */
3414
- 502: {
3415
- headers: {
3416
- [name: string]: unknown;
3417
- };
3418
- content: {
3419
- "application/json": components["schemas"]["Error"];
3420
- };
3421
- };
3422
- /** @description GitHub Apps are not configured */
3423
- 503: {
3424
- headers: {
3425
- [name: string]: unknown;
3426
- };
3427
- content: {
3428
- "application/json": components["schemas"]["Error"];
3429
- };
3430
- };
3431
- };
3432
- };
3433
- delete?: never;
3434
- options?: never;
3435
- head?: never;
3436
- patch?: never;
3437
- trace?: never;
3438
- };
3439
- "/agents/{id}/github-installation/repos/remove": {
3440
- parameters: {
3441
- query?: never;
3442
- header?: never;
3443
- path?: never;
3444
- cookie?: never;
3445
- };
3446
- get?: never;
3447
- put?: never;
3448
- /**
3449
- * Remove repos from the agent App's installation
3450
- * @description Platform-admin only. Revokes the agent's own GitHub App installation access to the named repos, with no plan step; the agent's configured repos are not changed. Writes one audit entry (GitHubReconcileAudit, planHash `direct:remove`) recording the caller and repos. Same errors as the add route.
3451
- */
3452
- post: {
3453
- parameters: {
3454
- query?: never;
3455
- header?: never;
3456
- path: {
3457
- id: string;
3458
- };
3459
- cookie?: never;
3460
- };
3461
- requestBody: {
3462
- content: {
3463
- "application/json": components["schemas"]["GithubInstallationReposBody"];
3464
- };
3465
- };
3466
- responses: {
3467
- /** @description Repos removed */
3468
- 200: {
3469
- headers: {
3470
- [name: string]: unknown;
3471
- };
3472
- content: {
3473
- "application/json": components["schemas"]["GithubInstallationReposChange"];
3474
- };
3475
- };
3476
- /** @description Unauthorized */
3477
- 401: {
3478
- headers: {
3479
- [name: string]: unknown;
3480
- };
3481
- content: {
3482
- "application/json": components["schemas"]["Error"];
3483
- };
3484
- };
3485
- /** @description Platform admin required */
3486
- 403: {
3487
- headers: {
3488
- [name: string]: unknown;
3489
- };
3490
- content: {
3491
- "application/json": components["schemas"]["Error"];
3492
- };
3493
- };
3494
- /** @description Agent not found */
3495
- 404: {
3496
- headers: {
3497
- [name: string]: unknown;
3498
- };
3499
- content: {
3500
- "application/json": components["schemas"]["Error"];
3501
- };
3502
- };
3503
- /** @description Agent App not installed on the org */
3504
- 409: {
3505
- headers: {
3506
- [name: string]: unknown;
3507
- };
3508
- content: {
3509
- "application/json": components["schemas"]["Error"];
3510
- };
3511
- };
3512
- /** @description Agent has no GH_APP_ID (its own GitHub App is not set up) */
3513
- 422: {
3514
- headers: {
3515
- [name: string]: unknown;
3516
- };
3517
- content: {
3518
- "application/json": components["schemas"]["Error"];
3519
- };
3520
- };
3521
- /** @description GitHub unavailable or refused */
3522
- 502: {
3523
- headers: {
3524
- [name: string]: unknown;
3525
- };
3526
- content: {
3527
- "application/json": components["schemas"]["Error"];
3528
- };
3529
- };
3530
- /** @description GitHub Apps are not configured */
3531
- 503: {
3532
- headers: {
3533
- [name: string]: unknown;
3534
- };
3535
- content: {
3536
- "application/json": components["schemas"]["Error"];
3537
- };
3538
- };
3539
- };
3540
- };
3178
+ post?: never;
3541
3179
  delete?: never;
3542
3180
  options?: never;
3543
3181
  head?: never;
3544
3182
  patch?: never;
3545
3183
  trace?: never;
3546
3184
  };
3547
- "/agents/{id}/github-lost-access/preview": {
3185
+ "/agents/{id}/github-sync/preview": {
3548
3186
  parameters: {
3549
3187
  query?: never;
3550
3188
  header?: never;
@@ -3552,8 +3190,8 @@ export interface paths {
3552
3190
  cookie?: never;
3553
3191
  };
3554
3192
  /**
3555
- * Preview removing the repos the bound user can no longer push to
3556
- * @description Platform-admin only (session members, ops keys and agent keys get 403). Read-only: nothing is changed or audited. Lists the repos on the agent App's installation or in the agent's repos that the bound githubUsername can no longer push to, and the agent's open tasks and PRs on them (via the optional open-work port; a port failure is a warning). Orgs whose access listing is missing, partial or failed, or whose lookup App is installed on selected repositories only, are skipped and reported. 200 with `status: skipped` when the user is unbound, not found or unverified, the agent has no GH_APP_ID, or the Apps are not configured.
3193
+ * Preview syncing the agent's GitHub access with its bound user
3194
+ * @description Platform-admin only (session members, ops keys and agent keys get 403). Read-only: nothing is changed or audited. Lists (1) repos to add to the agent App's installation, (2) installation repos to remove and (3) agent repos to remove, based on what the bound githubUsername can push to, plus the agent's open tasks and PRs the removals would block (via the optional open-work port; a port failure is a warning). The agent's repos are never added to. Orgs whose access listing is missing, partial or failed, or whose lookup App is not installed or installed on selected repositories only, are skipped (adds included) and reported. 200 with `status: skipped` when the user is unbound, not found or unverified, the agent has no GH_APP_ID, or the Apps are not configured.
3557
3195
  */
3558
3196
  get: {
3559
3197
  parameters: {
@@ -3566,13 +3204,13 @@ export interface paths {
3566
3204
  };
3567
3205
  requestBody?: never;
3568
3206
  responses: {
3569
- /** @description Lost-access removal preview */
3207
+ /** @description Sync preview */
3570
3208
  200: {
3571
3209
  headers: {
3572
3210
  [name: string]: unknown;
3573
3211
  };
3574
3212
  content: {
3575
- "application/json": components["schemas"]["GithubLostAccessPreview"];
3213
+ "application/json": components["schemas"]["GithubSyncPreview"];
3576
3214
  };
3577
3215
  };
3578
3216
  /** @description Unauthorized */
@@ -3630,7 +3268,7 @@ export interface paths {
3630
3268
  patch?: never;
3631
3269
  trace?: never;
3632
3270
  };
3633
- "/agents/{id}/github-lost-access/remove": {
3271
+ "/agents/{id}/github-sync/apply": {
3634
3272
  parameters: {
3635
3273
  query?: never;
3636
3274
  header?: never;
@@ -3640,8 +3278,8 @@ export interface paths {
3640
3278
  get?: never;
3641
3279
  put?: never;
3642
3280
  /**
3643
- * Remove the confirmed repos the bound user can no longer push to
3644
- * @description Platform-admin only. Never adds repos. Takes the repos the admin confirmed from the preview, re-checks each against the bound user's current access, and removes only those still without push access: first from the agent App's installation, then from the agent's repos; then writes one audit entry (GitHubReconcileAudit, planHash `lost-access:remove`) and blocks the agent's open work on the removed repos through the optional open-work port (a failure there is a warning). Named repos left alone are reported in `notRemoved`. Same skip rules as the preview: a skipped call (200 `status: skipped`) changes and audits nothing; `noop` when nothing named still lacks access. 422 when more than 10 repos would be removed without `confirmRemovals: true`. 502 when GitHub refuses (a failed audit entry records only what landed).
3281
+ * Apply the confirmed sync changes
3282
+ * @description Platform-admin only. Takes the exact lists the admin confirmed from the preview, re-checks each against the bound user's current access, and applies only what still qualifies: installation adds, installation removes, then agent-repo removes. Writes one audit entry (GitHubReconcileAudit, planHash `sync:apply`) and blocks the agent's open work on the removed repos through the optional open-work port (a failure there is a warning). Confirmed repos left alone are reported in `notApplied`. Same skip rules as the preview: a skipped call (200 `status: skipped`) changes and audits nothing; `noop` when nothing confirmed still applies. 422 when more than 10 repos would be removed without `confirmRemovals: true`. 502 when GitHub refuses (a failed audit entry records only what landed).
3645
3283
  */
3646
3284
  post: {
3647
3285
  parameters: {
@@ -3654,17 +3292,17 @@ export interface paths {
3654
3292
  };
3655
3293
  requestBody: {
3656
3294
  content: {
3657
- "application/json": components["schemas"]["GithubLostAccessRemoveBody"];
3295
+ "application/json": components["schemas"]["GithubSyncApplyBody"];
3658
3296
  };
3659
3297
  };
3660
3298
  responses: {
3661
- /** @description Removal result */
3299
+ /** @description Sync result */
3662
3300
  200: {
3663
3301
  headers: {
3664
3302
  [name: string]: unknown;
3665
3303
  };
3666
3304
  content: {
3667
- "application/json": components["schemas"]["GithubLostAccessRemoveResult"];
3305
+ "application/json": components["schemas"]["GithubSyncApplyResult"];
3668
3306
  };
3669
3307
  };
3670
3308
  /** @description Unauthorized */
@@ -5494,64 +5132,6 @@ export interface components {
5494
5132
  checkedAt: string;
5495
5133
  };
5496
5134
  };
5497
- GithubReconcilePlanResult: {
5498
- /**
5499
- * @description `skipped` (not an error) when no GitHub username is bound or the Apps are not configured; `reason` says why.
5500
- * @enum {string}
5501
- */
5502
- status: "planned" | "skipped";
5503
- reason?: string;
5504
- planHash?: string;
5505
- empty?: boolean;
5506
- diff?: {
5507
- installationAdds: string[];
5508
- installationRemoves: string[];
5509
- configAdds: string[];
5510
- configRemoves: string[];
5511
- };
5512
- skippedOrgs?: {
5513
- org: string;
5514
- reason: string;
5515
- }[];
5516
- rejectedAdds?: {
5517
- repo: string;
5518
- reason: string;
5519
- }[];
5520
- warnings?: string[];
5521
- /** @description Open work the removals would block; empty when no open-work port is wired. */
5522
- affectedOpenWork?: {
5523
- id: string;
5524
- repo: string;
5525
- title?: string;
5526
- }[];
5527
- };
5528
- GithubReconcilePlanBody: {
5529
- /** @description Repos (owner/repo) to explicitly add to the agent's config and installation. */
5530
- addRepos?: string[];
5531
- };
5532
- GithubReconcileApplyResult: {
5533
- /** @enum {string} */
5534
- status: "applied" | "failed" | "noop" | "skipped";
5535
- reason?: string;
5536
- auditId?: string;
5537
- planHash?: string;
5538
- diff?: {
5539
- installationAdds: string[];
5540
- installationRemoves: string[];
5541
- configAdds: string[];
5542
- configRemoves: string[];
5543
- };
5544
- warnings?: string[];
5545
- error?: string;
5546
- };
5547
- GithubReconcileApplyBody: {
5548
- /** @description planHash of the plan the admin reviewed. */
5549
- planHash: string;
5550
- /** @description Must match the addRepos used when the plan was made. */
5551
- addRepos?: string[];
5552
- /** @description Required when the plan removes more than 10 repos. */
5553
- confirmRemovals?: boolean;
5554
- };
5555
5135
  GithubInstallationReposList: {
5556
5136
  appId: number;
5557
5137
  orgs: {
@@ -5563,33 +5143,25 @@ export interface components {
5563
5143
  }[];
5564
5144
  }[];
5565
5145
  };
5566
- GithubInstallationReposChange: {
5567
- /** @enum {string} */
5568
- status: "applied";
5569
- auditId: string;
5570
- repos: string[];
5571
- };
5572
- GithubInstallationReposBody: {
5573
- /** @description Repos (owner/repo) to change on the agent App's installation. */
5574
- repos: string[];
5575
- };
5576
- GithubLostAccessPreview: {
5146
+ GithubSyncPreview: {
5577
5147
  /**
5578
5148
  * @description `skipped` (not an error) when no GitHub username is bound, the user is not found or unverified, the agent has no GH_APP_ID, or the Apps are not configured; `reason` says why.
5579
5149
  * @enum {string}
5580
5150
  */
5581
5151
  status: "previewed" | "skipped";
5582
5152
  reason?: string;
5583
- /** @description Every repo the bound user can no longer push to that would be removed from the installation or the agent's repos. */
5584
- repos?: string[];
5585
- installationRemoves?: string[];
5586
- configRemoves?: string[];
5587
- /** @description Orgs whose access listing is missing, partial or failed, or whose lookup App is installed on selected repositories only; nothing there is removed. */
5153
+ /** @description Repos the bound user can push to, in orgs the agent App is installed on with a complete access listing, that are not on the installation. No cap. */
5154
+ appAdds?: string[];
5155
+ /** @description Installation repos the bound user can no longer push to. */
5156
+ appRemoves?: string[];
5157
+ /** @description Configured agent repos the bound user can no longer push to. The agent's repos are never added to. */
5158
+ agentRemoves?: string[];
5159
+ /** @description Orgs whose access listing is missing, partial or failed, or whose lookup App is not installed or installed on selected repositories only; nothing there is added or removed. */
5588
5160
  skippedOrgs?: {
5589
5161
  org: string;
5590
5162
  reason: string;
5591
5163
  }[];
5592
- /** @description The agent's open tasks and PRs on those repos that removing them would block; empty when no open-work port is wired. */
5164
+ /** @description The agent's open tasks and PRs on the removed repos that the removals would block; empty when no open-work port is wired. */
5593
5165
  openWork?: {
5594
5166
  id: string;
5595
5167
  repo: string;
@@ -5597,16 +5169,16 @@ export interface components {
5597
5169
  }[];
5598
5170
  warnings?: string[];
5599
5171
  };
5600
- GithubLostAccessRemoveResult: {
5172
+ GithubSyncApplyResult: {
5601
5173
  /** @enum {string} */
5602
5174
  status: "applied" | "noop" | "skipped";
5603
5175
  reason?: string;
5604
5176
  auditId?: string;
5605
- repos?: string[];
5606
- installationRemoves?: string[];
5607
- configRemoves?: string[];
5608
- /** @description Named repos left alone: the user can still push, the org was skipped, or the repo is on neither the installation nor the agent. */
5609
- notRemoved?: {
5177
+ appAdds?: string[];
5178
+ appRemoves?: string[];
5179
+ agentRemoves?: string[];
5180
+ /** @description Confirmed repos left alone: access changed since the preview, the org was skipped, or the repo is not where the change expected it. */
5181
+ notApplied?: {
5610
5182
  repo: string;
5611
5183
  reason: string;
5612
5184
  }[];
@@ -5616,10 +5188,23 @@ export interface components {
5616
5188
  }[];
5617
5189
  warnings?: string[];
5618
5190
  };
5619
- GithubLostAccessRemoveBody: {
5620
- /** @description The repos (owner/repo) the admin confirmed from the preview. Each is re-checked; only those the user still cannot push to are removed. */
5621
- repos: string[];
5622
- /** @description Required when more than 10 repos would be removed. */
5191
+ GithubSyncApplyBody: {
5192
+ /**
5193
+ * @description Repos (owner/repo) the admin confirmed to add to the agent App's installation.
5194
+ * @default []
5195
+ */
5196
+ appAdds: string[];
5197
+ /**
5198
+ * @description Repos the admin confirmed to remove from the agent App's installation.
5199
+ * @default []
5200
+ */
5201
+ appRemoves: string[];
5202
+ /**
5203
+ * @description Repos the admin confirmed to remove from the agent's repos.
5204
+ * @default []
5205
+ */
5206
+ agentRemoves: string[];
5207
+ /** @description Required when more than 10 distinct repos would be removed. */
5623
5208
  confirmRemovals?: boolean;
5624
5209
  };
5625
5210
  AgentConfigResponse: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@app-vitals/agent-lib",
3
- "version": "1.35.0",
3
+ "version": "1.36.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/app-vitals/agent.git",