@app-vitals/agent-lib 1.35.1 → 1.36.1

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 -239
  2. package/package.json +1 -1
package/admin-types.ts CHANGED
@@ -3175,214 +3175,14 @@ export interface paths {
3175
3175
  };
3176
3176
  };
3177
3177
  put?: never;
3178
- /**
3179
- * Add repos to the agent App's installation
3180
- * @description Platform-admin only. Grants the agent's own GitHub App installation access to the named repos; 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).
3181
- */
3182
- post: {
3183
- parameters: {
3184
- query?: never;
3185
- header?: never;
3186
- path: {
3187
- id: string;
3188
- };
3189
- cookie?: never;
3190
- };
3191
- requestBody: {
3192
- content: {
3193
- "application/json": components["schemas"]["GithubInstallationReposBody"];
3194
- };
3195
- };
3196
- responses: {
3197
- /** @description Repos added */
3198
- 200: {
3199
- headers: {
3200
- [name: string]: unknown;
3201
- };
3202
- content: {
3203
- "application/json": components["schemas"]["GithubInstallationReposChange"];
3204
- };
3205
- };
3206
- /** @description Unauthorized */
3207
- 401: {
3208
- headers: {
3209
- [name: string]: unknown;
3210
- };
3211
- content: {
3212
- "application/json": components["schemas"]["Error"];
3213
- };
3214
- };
3215
- /** @description Platform admin required */
3216
- 403: {
3217
- headers: {
3218
- [name: string]: unknown;
3219
- };
3220
- content: {
3221
- "application/json": components["schemas"]["Error"];
3222
- };
3223
- };
3224
- /** @description Agent not found */
3225
- 404: {
3226
- headers: {
3227
- [name: string]: unknown;
3228
- };
3229
- content: {
3230
- "application/json": components["schemas"]["Error"];
3231
- };
3232
- };
3233
- /** @description Agent App not installed on the org */
3234
- 409: {
3235
- headers: {
3236
- [name: string]: unknown;
3237
- };
3238
- content: {
3239
- "application/json": components["schemas"]["Error"];
3240
- };
3241
- };
3242
- /** @description Agent has no GH_APP_ID (its own GitHub App is not set up) */
3243
- 422: {
3244
- headers: {
3245
- [name: string]: unknown;
3246
- };
3247
- content: {
3248
- "application/json": components["schemas"]["Error"];
3249
- };
3250
- };
3251
- /** @description GitHub unavailable or refused */
3252
- 502: {
3253
- headers: {
3254
- [name: string]: unknown;
3255
- };
3256
- content: {
3257
- "application/json": components["schemas"]["Error"];
3258
- };
3259
- };
3260
- /** @description GitHub Apps are not configured */
3261
- 503: {
3262
- headers: {
3263
- [name: string]: unknown;
3264
- };
3265
- content: {
3266
- "application/json": components["schemas"]["Error"];
3267
- };
3268
- };
3269
- };
3270
- };
3271
- delete?: never;
3272
- options?: never;
3273
- head?: never;
3274
- patch?: never;
3275
- trace?: never;
3276
- };
3277
- "/agents/{id}/github-installation/repos/remove": {
3278
- parameters: {
3279
- query?: never;
3280
- header?: never;
3281
- path?: never;
3282
- cookie?: never;
3283
- };
3284
- get?: never;
3285
- put?: never;
3286
- /**
3287
- * Remove repos from the agent App's installation
3288
- * @description Platform-admin only. Revokes the agent's own GitHub App installation access to the named repos; 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.
3289
- */
3290
- post: {
3291
- parameters: {
3292
- query?: never;
3293
- header?: never;
3294
- path: {
3295
- id: string;
3296
- };
3297
- cookie?: never;
3298
- };
3299
- requestBody: {
3300
- content: {
3301
- "application/json": components["schemas"]["GithubInstallationReposBody"];
3302
- };
3303
- };
3304
- responses: {
3305
- /** @description Repos removed */
3306
- 200: {
3307
- headers: {
3308
- [name: string]: unknown;
3309
- };
3310
- content: {
3311
- "application/json": components["schemas"]["GithubInstallationReposChange"];
3312
- };
3313
- };
3314
- /** @description Unauthorized */
3315
- 401: {
3316
- headers: {
3317
- [name: string]: unknown;
3318
- };
3319
- content: {
3320
- "application/json": components["schemas"]["Error"];
3321
- };
3322
- };
3323
- /** @description Platform admin required */
3324
- 403: {
3325
- headers: {
3326
- [name: string]: unknown;
3327
- };
3328
- content: {
3329
- "application/json": components["schemas"]["Error"];
3330
- };
3331
- };
3332
- /** @description Agent not found */
3333
- 404: {
3334
- headers: {
3335
- [name: string]: unknown;
3336
- };
3337
- content: {
3338
- "application/json": components["schemas"]["Error"];
3339
- };
3340
- };
3341
- /** @description Agent App not installed on the org */
3342
- 409: {
3343
- headers: {
3344
- [name: string]: unknown;
3345
- };
3346
- content: {
3347
- "application/json": components["schemas"]["Error"];
3348
- };
3349
- };
3350
- /** @description Agent has no GH_APP_ID (its own GitHub App is not set up) */
3351
- 422: {
3352
- headers: {
3353
- [name: string]: unknown;
3354
- };
3355
- content: {
3356
- "application/json": components["schemas"]["Error"];
3357
- };
3358
- };
3359
- /** @description GitHub unavailable or refused */
3360
- 502: {
3361
- headers: {
3362
- [name: string]: unknown;
3363
- };
3364
- content: {
3365
- "application/json": components["schemas"]["Error"];
3366
- };
3367
- };
3368
- /** @description GitHub Apps are not configured */
3369
- 503: {
3370
- headers: {
3371
- [name: string]: unknown;
3372
- };
3373
- content: {
3374
- "application/json": components["schemas"]["Error"];
3375
- };
3376
- };
3377
- };
3378
- };
3178
+ post?: never;
3379
3179
  delete?: never;
3380
3180
  options?: never;
3381
3181
  head?: never;
3382
3182
  patch?: never;
3383
3183
  trace?: never;
3384
3184
  };
3385
- "/agents/{id}/github-lost-access/preview": {
3185
+ "/agents/{id}/github-sync/preview": {
3386
3186
  parameters: {
3387
3187
  query?: never;
3388
3188
  header?: never;
@@ -3390,8 +3190,8 @@ export interface paths {
3390
3190
  cookie?: never;
3391
3191
  };
3392
3192
  /**
3393
- * Preview removing the repos the bound user can no longer push to
3394
- * @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.
3395
3195
  */
3396
3196
  get: {
3397
3197
  parameters: {
@@ -3404,13 +3204,13 @@ export interface paths {
3404
3204
  };
3405
3205
  requestBody?: never;
3406
3206
  responses: {
3407
- /** @description Lost-access removal preview */
3207
+ /** @description Sync preview */
3408
3208
  200: {
3409
3209
  headers: {
3410
3210
  [name: string]: unknown;
3411
3211
  };
3412
3212
  content: {
3413
- "application/json": components["schemas"]["GithubLostAccessPreview"];
3213
+ "application/json": components["schemas"]["GithubSyncPreview"];
3414
3214
  };
3415
3215
  };
3416
3216
  /** @description Unauthorized */
@@ -3468,7 +3268,7 @@ export interface paths {
3468
3268
  patch?: never;
3469
3269
  trace?: never;
3470
3270
  };
3471
- "/agents/{id}/github-lost-access/remove": {
3271
+ "/agents/{id}/github-sync/apply": {
3472
3272
  parameters: {
3473
3273
  query?: never;
3474
3274
  header?: never;
@@ -3478,8 +3278,8 @@ export interface paths {
3478
3278
  get?: never;
3479
3279
  put?: never;
3480
3280
  /**
3481
- * Remove the confirmed repos the bound user can no longer push to
3482
- * @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).
3483
3283
  */
3484
3284
  post: {
3485
3285
  parameters: {
@@ -3492,17 +3292,17 @@ export interface paths {
3492
3292
  };
3493
3293
  requestBody: {
3494
3294
  content: {
3495
- "application/json": components["schemas"]["GithubLostAccessRemoveBody"];
3295
+ "application/json": components["schemas"]["GithubSyncApplyBody"];
3496
3296
  };
3497
3297
  };
3498
3298
  responses: {
3499
- /** @description Removal result */
3299
+ /** @description Sync result */
3500
3300
  200: {
3501
3301
  headers: {
3502
3302
  [name: string]: unknown;
3503
3303
  };
3504
3304
  content: {
3505
- "application/json": components["schemas"]["GithubLostAccessRemoveResult"];
3305
+ "application/json": components["schemas"]["GithubSyncApplyResult"];
3506
3306
  };
3507
3307
  };
3508
3308
  /** @description Unauthorized */
@@ -5343,33 +5143,25 @@ export interface components {
5343
5143
  }[];
5344
5144
  }[];
5345
5145
  };
5346
- GithubInstallationReposChange: {
5347
- /** @enum {string} */
5348
- status: "applied";
5349
- auditId: string;
5350
- repos: string[];
5351
- };
5352
- GithubInstallationReposBody: {
5353
- /** @description Repos (owner/repo) to change on the agent App's installation. */
5354
- repos: string[];
5355
- };
5356
- GithubLostAccessPreview: {
5146
+ GithubSyncPreview: {
5357
5147
  /**
5358
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.
5359
5149
  * @enum {string}
5360
5150
  */
5361
5151
  status: "previewed" | "skipped";
5362
5152
  reason?: string;
5363
- /** @description Every repo the bound user can no longer push to that would be removed from the installation or the agent's repos. */
5364
- repos?: string[];
5365
- installationRemoves?: string[];
5366
- configRemoves?: string[];
5367
- /** @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. */
5368
5160
  skippedOrgs?: {
5369
5161
  org: string;
5370
5162
  reason: string;
5371
5163
  }[];
5372
- /** @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. */
5373
5165
  openWork?: {
5374
5166
  id: string;
5375
5167
  repo: string;
@@ -5377,16 +5169,16 @@ export interface components {
5377
5169
  }[];
5378
5170
  warnings?: string[];
5379
5171
  };
5380
- GithubLostAccessRemoveResult: {
5172
+ GithubSyncApplyResult: {
5381
5173
  /** @enum {string} */
5382
5174
  status: "applied" | "noop" | "skipped";
5383
5175
  reason?: string;
5384
5176
  auditId?: string;
5385
- repos?: string[];
5386
- installationRemoves?: string[];
5387
- configRemoves?: string[];
5388
- /** @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. */
5389
- 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?: {
5390
5182
  repo: string;
5391
5183
  reason: string;
5392
5184
  }[];
@@ -5396,10 +5188,23 @@ export interface components {
5396
5188
  }[];
5397
5189
  warnings?: string[];
5398
5190
  };
5399
- GithubLostAccessRemoveBody: {
5400
- /** @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. */
5401
- repos: string[];
5402
- /** @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. */
5403
5208
  confirmRemovals?: boolean;
5404
5209
  };
5405
5210
  AgentConfigResponse: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@app-vitals/agent-lib",
3
- "version": "1.35.1",
3
+ "version": "1.36.1",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/app-vitals/agent.git",