@app-vitals/agent-lib 1.33.0 → 1.34.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 +234 -0
  2. package/package.json +1 -1
package/admin-types.ts CHANGED
@@ -3544,6 +3544,191 @@ export interface paths {
3544
3544
  patch?: never;
3545
3545
  trace?: never;
3546
3546
  };
3547
+ "/agents/{id}/github-lost-access/preview": {
3548
+ parameters: {
3549
+ query?: never;
3550
+ header?: never;
3551
+ path?: never;
3552
+ cookie?: never;
3553
+ };
3554
+ /**
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.
3557
+ */
3558
+ get: {
3559
+ parameters: {
3560
+ query?: never;
3561
+ header?: never;
3562
+ path: {
3563
+ id: string;
3564
+ };
3565
+ cookie?: never;
3566
+ };
3567
+ requestBody?: never;
3568
+ responses: {
3569
+ /** @description Lost-access removal preview */
3570
+ 200: {
3571
+ headers: {
3572
+ [name: string]: unknown;
3573
+ };
3574
+ content: {
3575
+ "application/json": components["schemas"]["GithubLostAccessPreview"];
3576
+ };
3577
+ };
3578
+ /** @description Unauthorized */
3579
+ 401: {
3580
+ headers: {
3581
+ [name: string]: unknown;
3582
+ };
3583
+ content: {
3584
+ "application/json": components["schemas"]["Error"];
3585
+ };
3586
+ };
3587
+ /** @description Platform admin required */
3588
+ 403: {
3589
+ headers: {
3590
+ [name: string]: unknown;
3591
+ };
3592
+ content: {
3593
+ "application/json": components["schemas"]["Error"];
3594
+ };
3595
+ };
3596
+ /** @description Agent not found */
3597
+ 404: {
3598
+ headers: {
3599
+ [name: string]: unknown;
3600
+ };
3601
+ content: {
3602
+ "application/json": components["schemas"]["Error"];
3603
+ };
3604
+ };
3605
+ /** @description GitHub unavailable or refused */
3606
+ 502: {
3607
+ headers: {
3608
+ [name: string]: unknown;
3609
+ };
3610
+ content: {
3611
+ "application/json": components["schemas"]["Error"];
3612
+ };
3613
+ };
3614
+ /** @description GitHub Apps are not configured */
3615
+ 503: {
3616
+ headers: {
3617
+ [name: string]: unknown;
3618
+ };
3619
+ content: {
3620
+ "application/json": components["schemas"]["Error"];
3621
+ };
3622
+ };
3623
+ };
3624
+ };
3625
+ put?: never;
3626
+ post?: never;
3627
+ delete?: never;
3628
+ options?: never;
3629
+ head?: never;
3630
+ patch?: never;
3631
+ trace?: never;
3632
+ };
3633
+ "/agents/{id}/github-lost-access/remove": {
3634
+ parameters: {
3635
+ query?: never;
3636
+ header?: never;
3637
+ path?: never;
3638
+ cookie?: never;
3639
+ };
3640
+ get?: never;
3641
+ put?: never;
3642
+ /**
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).
3645
+ */
3646
+ post: {
3647
+ parameters: {
3648
+ query?: never;
3649
+ header?: never;
3650
+ path: {
3651
+ id: string;
3652
+ };
3653
+ cookie?: never;
3654
+ };
3655
+ requestBody: {
3656
+ content: {
3657
+ "application/json": components["schemas"]["GithubLostAccessRemoveBody"];
3658
+ };
3659
+ };
3660
+ responses: {
3661
+ /** @description Removal result */
3662
+ 200: {
3663
+ headers: {
3664
+ [name: string]: unknown;
3665
+ };
3666
+ content: {
3667
+ "application/json": components["schemas"]["GithubLostAccessRemoveResult"];
3668
+ };
3669
+ };
3670
+ /** @description Unauthorized */
3671
+ 401: {
3672
+ headers: {
3673
+ [name: string]: unknown;
3674
+ };
3675
+ content: {
3676
+ "application/json": components["schemas"]["Error"];
3677
+ };
3678
+ };
3679
+ /** @description Platform admin required */
3680
+ 403: {
3681
+ headers: {
3682
+ [name: string]: unknown;
3683
+ };
3684
+ content: {
3685
+ "application/json": components["schemas"]["Error"];
3686
+ };
3687
+ };
3688
+ /** @description Agent not found */
3689
+ 404: {
3690
+ headers: {
3691
+ [name: string]: unknown;
3692
+ };
3693
+ content: {
3694
+ "application/json": components["schemas"]["Error"];
3695
+ };
3696
+ };
3697
+ /** @description Removal cap needs confirmRemovals */
3698
+ 422: {
3699
+ headers: {
3700
+ [name: string]: unknown;
3701
+ };
3702
+ content: {
3703
+ "application/json": components["schemas"]["Error"];
3704
+ };
3705
+ };
3706
+ /** @description GitHub unavailable or refused */
3707
+ 502: {
3708
+ headers: {
3709
+ [name: string]: unknown;
3710
+ };
3711
+ content: {
3712
+ "application/json": components["schemas"]["Error"];
3713
+ };
3714
+ };
3715
+ /** @description GitHub Apps are not configured */
3716
+ 503: {
3717
+ headers: {
3718
+ [name: string]: unknown;
3719
+ };
3720
+ content: {
3721
+ "application/json": components["schemas"]["Error"];
3722
+ };
3723
+ };
3724
+ };
3725
+ };
3726
+ delete?: never;
3727
+ options?: never;
3728
+ head?: never;
3729
+ patch?: never;
3730
+ trace?: never;
3731
+ };
3547
3732
  "/agents/{id}/config": {
3548
3733
  parameters: {
3549
3734
  query?: never;
@@ -5388,6 +5573,55 @@ export interface components {
5388
5573
  /** @description Repos (owner/repo) to change on the agent App's installation. */
5389
5574
  repos: string[];
5390
5575
  };
5576
+ GithubLostAccessPreview: {
5577
+ /**
5578
+ * @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
+ * @enum {string}
5580
+ */
5581
+ status: "previewed" | "skipped";
5582
+ 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. */
5588
+ skippedOrgs?: {
5589
+ org: string;
5590
+ reason: string;
5591
+ }[];
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. */
5593
+ openWork?: {
5594
+ id: string;
5595
+ repo: string;
5596
+ title?: string;
5597
+ }[];
5598
+ warnings?: string[];
5599
+ };
5600
+ GithubLostAccessRemoveResult: {
5601
+ /** @enum {string} */
5602
+ status: "applied" | "noop" | "skipped";
5603
+ reason?: string;
5604
+ 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?: {
5610
+ repo: string;
5611
+ reason: string;
5612
+ }[];
5613
+ skippedOrgs?: {
5614
+ org: string;
5615
+ reason: string;
5616
+ }[];
5617
+ warnings?: string[];
5618
+ };
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. */
5623
+ confirmRemovals?: boolean;
5624
+ };
5391
5625
  AgentConfigResponse: {
5392
5626
  /**
5393
5627
  * @example {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@app-vitals/agent-lib",
3
- "version": "1.33.0",
3
+ "version": "1.34.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/app-vitals/agent.git",