@app-vitals/agent-admin 1.107.5 → 1.108.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 (40) hide show
  1. package/e2e/real/admin-access.real.e2e.ts +77 -68
  2. package/e2e/real/agent-management.real.e2e.ts +165 -143
  3. package/e2e/real/owner-access.real.e2e.ts +228 -212
  4. package/openapi.platform.json +127 -6
  5. package/package.json +2 -2
  6. package/src/account-created-notifier.ts +1 -1
  7. package/src/account-onboarding.integration.test.ts +69 -0
  8. package/src/account-onboarding.ts +29 -3
  9. package/src/account-repo-lookup-api.integration.test.ts +163 -0
  10. package/src/account-repo-lookup-api.ts +106 -0
  11. package/src/account-repo-lookup.ts +89 -0
  12. package/src/account-trial-expiry-sweeper.ts +1 -1
  13. package/src/accounts-api.integration.test.ts +5 -2
  14. package/src/accounts-api.smoke.test.ts +21 -5
  15. package/src/accounts-api.ts +12 -15
  16. package/src/admin-boot-config.ts +2 -0
  17. package/src/admin-boot-config.unit.test.ts +27 -0
  18. package/src/admin-boot.ts +18 -10
  19. package/src/admin-spec.ts +6 -0
  20. package/src/admin-ui-account.smoke.test.ts +7 -3
  21. package/src/admin-ui-account.ts +10 -15
  22. package/src/admin-ui-accounts.smoke.test.ts +4 -4
  23. package/src/admin-ui-accounts.ts +7 -11
  24. package/src/admin-ui-settings-nav-context.smoke.test.ts +24 -0
  25. package/src/admin-ui-settings.smoke.test.ts +17 -1
  26. package/src/admin-ui.smoke.test.ts +168 -2
  27. package/src/admin-ui.ts +39 -26
  28. package/src/agent-management-access.integration.test.ts +18 -6
  29. package/src/agent-manifest.ts +2 -1
  30. package/src/agent-provisioner.integration.test.ts +10 -10
  31. package/src/agent-provisioner.ts +10 -1
  32. package/src/agent-provisioner.unit.test.ts +110 -36
  33. package/src/agent-templates-api.integration.test.ts +23 -5
  34. package/src/agent-templates-api.ts +11 -8
  35. package/src/caller-scope.integration.test.ts +8 -6
  36. package/src/caller-scope.ts +32 -26
  37. package/src/caller-scope.unit.test.ts +15 -11
  38. package/src/openapi-schemas.ts +22 -0
  39. package/src/platform-routes.ts +14 -2
  40. package/src/platform-routes.unit.test.ts +2 -0
@@ -1630,3 +1630,25 @@ export const PrincipalByEmailQuerySchema = z.object({
1630
1630
  .min(1)
1631
1631
  .openapi({ param: { name: "email", in: "query" }, example: "o@acme.com" }),
1632
1632
  });
1633
+
1634
+ // ─── Account lookup by repo (MA-2.5) ──────────────────────────────────────────
1635
+
1636
+ export const AccountRepoLookupBodySchema = z
1637
+ .object({ repos: z.array(z.string().min(1)).max(500) })
1638
+ .openapi("AccountRepoLookupBody");
1639
+
1640
+ export const AccountRepoLookupResponseSchema = z
1641
+ .object({
1642
+ repos: z.array(
1643
+ z.object({
1644
+ repo: z.string().openapi({ example: "acme/widgets" }),
1645
+ accountIds: z.array(z.string()).openapi({ example: ["acct-a"] }),
1646
+ }),
1647
+ ),
1648
+ singleAccount: z.boolean(),
1649
+ singleAccountId: z
1650
+ .string()
1651
+ .nullable()
1652
+ .openapi({ description: "Set only when singleAccount is true" }),
1653
+ })
1654
+ .openapi("AccountRepoLookupResponse");
@@ -20,10 +20,12 @@ import { type AdminDeps, createAdminApp } from "./agents-api.ts";
20
20
  import { createAgentRuntimeApp } from "./api.ts";
21
21
  import { createGithubEnterpriseApp } from "./github-enterprise-api.ts";
22
22
  import { mountPlatformDoc } from "./platform-doc-route.ts";
23
+ import { createAccountRepoLookupApp } from "./account-repo-lookup-api.ts";
23
24
  import { createPrincipalsApp } from "./principals-api.ts";
24
25
 
25
26
  type AgentRuntimeDeps = Parameters<typeof createAgentRuntimeApp>[0];
26
27
  type AccountsDeps = Parameters<typeof createAccountsApp>[0];
28
+ type AccountRepoLookupDeps = Parameters<typeof createAccountRepoLookupApp>[0];
27
29
  type PrincipalsDeps = Parameters<typeof createPrincipalsApp>[0];
28
30
  type TemplatesDeps = Parameters<typeof createAgentTemplatesApp>[0];
29
31
  type GithubEnterpriseDeps = Parameters<typeof createGithubEnterpriseApp>[0];
@@ -38,6 +40,8 @@ export interface PlatformApiDeps {
38
40
  };
39
41
  accounts: AccountsDeps;
40
42
  principals: PrincipalsDeps;
43
+ /** Optional so existing callers need not change (additive). */
44
+ accountRepoLookup?: AccountRepoLookupDeps;
41
45
  templates: TemplatesDeps;
42
46
  githubEnterprise: GithubEnterpriseDeps;
43
47
  }
@@ -92,7 +96,7 @@ export function mountPlatformApis(
92
96
  const adminApiApp = createAdminApp(deps.adminApi);
93
97
  mount({ name: "admin", prefix: "/", app: adminApiApp, inSpec: true });
94
98
 
95
- // Platform OpenAPI document — GET /doc, flag-gated (not mounted when off).
99
+ // Platform OpenAPI document — GET /doc (mounted when the host supplies doc deps).
96
100
  if (deps.doc) mountPlatformDoc(root, deps.doc);
97
101
 
98
102
  mount({
@@ -101,7 +105,7 @@ export function mountPlatformApis(
101
105
  app: createAccountsApp(deps.accounts),
102
106
  inSpec: false,
103
107
  specExclusion:
104
- "flag-gated (self-serve signup); never part of the committed platform spec",
108
+ "account administration (admin-only); never part of the committed platform spec",
105
109
  });
106
110
  // The three apps below own disjoint prefixes, so their relative order does
107
111
  // not affect routing; it is fixed to keep the committed spec's key order.
@@ -124,6 +128,14 @@ export function mountPlatformApis(
124
128
  app: createPrincipalsApp(deps.principals),
125
129
  inSpec: true,
126
130
  });
131
+ if (deps.accountRepoLookup) {
132
+ mount({
133
+ name: "account-repo-lookup",
134
+ prefix: "/",
135
+ app: createAccountRepoLookupApp(deps.accountRepoLookup),
136
+ inSpec: true,
137
+ });
138
+ }
127
139
 
128
140
  return {
129
141
  mounted,
@@ -24,6 +24,7 @@ function mountWithStubs() {
24
24
  adminApi: { ...common, provisioner: undefined },
25
25
  accounts: { accountService: {}, accountLifecycle: {}, ...common },
26
26
  principals: { lookup: {}, ...common },
27
+ accountRepoLookup: { lookup: {}, ...common },
27
28
  templates: {
28
29
  templateService: {},
29
30
  callerScopeResolver: async () => ({ kind: "all" }),
@@ -55,6 +56,7 @@ describe("mountPlatformApis", () => {
55
56
  "github-enterprise",
56
57
  "templates",
57
58
  "principals",
59
+ "account-repo-lookup",
58
60
  ]);
59
61
  });
60
62