adspower-browser 1.0.1 → 1.0.2

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/build/cli.js +519 -28
  2. package/package.json +1 -1
package/build/cli.js CHANGED
@@ -75,7 +75,14 @@ var API_ENDPOINTS = {
75
75
  GET_GROUP_LIST: "/api/v1/group/list",
76
76
  CREATE_GROUP: "/api/v1/group/create",
77
77
  UPDATE_GROUP: "/api/v1/group/update",
78
- GET_APPLICATION_LIST: "/api/v2/category/list"
78
+ GET_APPLICATION_LIST: "/api/v2/category/list",
79
+ GET_TAG_LIST: "/api/v2/browser-tags/list",
80
+ CREATE_TAG: "/api/v2/browser-tags/create",
81
+ UPDATE_TAG: "/api/v2/browser-tags/update",
82
+ DELETE_TAG: "/api/v2/browser-tags/delete",
83
+ DOWNLOAD_KERNEL: "/api/v2/browser-profile/download-kernel",
84
+ GET_KERNEL_LIST: "/api/v2/browser-profile/kernels",
85
+ UPDATE_PATCH: "/api/v2/browser-profile/update-patch"
79
86
  };
80
87
  var apiClient = import_axios.default.create({
81
88
  headers: API_KEY ? { "Authorization": `Bearer ${API_KEY}` } : {}
@@ -104,7 +111,9 @@ function buildRequestBody(params) {
104
111
  ipchecker: "ipchecker",
105
112
  categoryId: "category_id",
106
113
  launchArgs: "launch_args",
107
- profileId: "profile_id"
114
+ profileId: "profile_id",
115
+ profileTagIds: "profile_tag_ids",
116
+ tagsUpdateType: "tags_update_type"
108
117
  };
109
118
  Object.entries(basicFields).forEach(([paramKey, key]) => {
110
119
  const value = params[paramKey];
@@ -216,7 +225,7 @@ var browserHandlers = {
216
225
  throw new Error(`Failed to delete browsers: ${response.data.msg}`);
217
226
  },
218
227
  async getBrowserList(params) {
219
- const { groupId, limit, page, profileId, profileNo, sortType, sortOrder } = params;
228
+ const { groupId, limit, page, profileId, profileNo, sortType, sortOrder, tag_ids, tags_filter, name, name_filter } = params;
220
229
  const requestBody = {};
221
230
  if (limit !== void 0) {
222
231
  requestBody.limit = limit;
@@ -239,6 +248,18 @@ var browserHandlers = {
239
248
  if (sortOrder) {
240
249
  requestBody.sort_order = sortOrder;
241
250
  }
251
+ if (tag_ids && tag_ids.length > 0) {
252
+ requestBody.tag_ids = tag_ids;
253
+ }
254
+ if (tags_filter) {
255
+ requestBody.tags_filter = tags_filter;
256
+ }
257
+ if (name) {
258
+ requestBody.name = name;
259
+ }
260
+ if (name_filter) {
261
+ requestBody.name_filter = name_filter;
262
+ }
242
263
  const response = await apiClient.post(`${LOCAL_API_BASE}${API_ENDPOINTS.GET_BROWSER_LIST}`, requestBody);
243
264
  if (response.data.code === 0) {
244
265
  return `Browser list: ${JSON.stringify(response.data.data.list, null, 2)}`;
@@ -530,6 +551,49 @@ var proxyHandlers = {
530
551
  }
531
552
  };
532
553
 
554
+ // ../core/src/handlers/tag.ts
555
+ var tagHandlers = {
556
+ async getTagList(params) {
557
+ const { ids, limit, page } = params;
558
+ const requestBody = {};
559
+ if (ids && ids.length > 0) {
560
+ requestBody.ids = ids;
561
+ }
562
+ if (limit !== void 0) {
563
+ requestBody.limit = limit;
564
+ }
565
+ if (page !== void 0) {
566
+ requestBody.page = page;
567
+ }
568
+ const response = await apiClient.post(`${LOCAL_API_BASE}${API_ENDPOINTS.GET_TAG_LIST}`, requestBody);
569
+ if (response.data.code === 0) {
570
+ return `Tag list: ${JSON.stringify(response.data.data.list || response.data.data, null, 2)}`;
571
+ }
572
+ throw new Error(`Failed to get tag list: ${response.data.msg}`);
573
+ },
574
+ async createTag({ tags }) {
575
+ const response = await apiClient.post(`${LOCAL_API_BASE}${API_ENDPOINTS.CREATE_TAG}`, { tags });
576
+ if (response.data.code === 0) {
577
+ return `Tags created successfully: ${JSON.stringify(response.data.data, null, 2)}`;
578
+ }
579
+ throw new Error(`Failed to create tags: ${response.data.msg}`);
580
+ },
581
+ async updateTag({ tags }) {
582
+ const response = await apiClient.post(`${LOCAL_API_BASE}${API_ENDPOINTS.UPDATE_TAG}`, { tags });
583
+ if (response.data.code === 0) {
584
+ return `Tags updated successfully: ${JSON.stringify(response.data.data, null, 2)}`;
585
+ }
586
+ throw new Error(`Failed to update tags: ${response.data.msg}`);
587
+ },
588
+ async deleteTag({ ids }) {
589
+ const response = await apiClient.post(`${LOCAL_API_BASE}${API_ENDPOINTS.DELETE_TAG}`, { ids });
590
+ if (response.data.code === 0) {
591
+ return `Tags deleted successfully: ${ids.join(", ")}`;
592
+ }
593
+ throw new Error(`Failed to delete tags: ${response.data.msg}`);
594
+ }
595
+ };
596
+
533
597
  // ../core/src/handlers/automation.ts
534
598
  var import_path = __toESM(require("path"));
535
599
  var import_os = __toESM(require("os"));
@@ -587,6 +651,46 @@ var browserBase_default = new BrowserBase();
587
651
  // ../core/src/handlers/automation.ts
588
652
  var defaultDownloadsPath = import_path.default.join(import_os.default.homedir(), "Downloads");
589
653
 
654
+ // ../core/src/handlers/kernel.ts
655
+ var kernelHandlers = {
656
+ async downloadKernel({ kernel_type, kernel_version }) {
657
+ const response = await apiClient.post(`${LOCAL_API_BASE}${API_ENDPOINTS.DOWNLOAD_KERNEL}`, {
658
+ kernel_type,
659
+ kernel_version
660
+ });
661
+ if (response.data.code === 0) {
662
+ return `Kernel download/update status: ${JSON.stringify(response.data.data, null, 2)}`;
663
+ }
664
+ throw new Error(`Failed to download/update kernel: ${response.data.msg}`);
665
+ },
666
+ async getKernelList({ kernel_type }) {
667
+ const params = new URLSearchParams();
668
+ if (kernel_type) {
669
+ params.set("kernel_type", kernel_type);
670
+ }
671
+ const response = await apiClient.get(`${LOCAL_API_BASE}${API_ENDPOINTS.GET_KERNEL_LIST}`, { params });
672
+ if (response.data.code === 0) {
673
+ return `Kernel list: ${JSON.stringify(response.data.data.list || response.data.data, null, 2)}`;
674
+ }
675
+ throw new Error(`Failed to get kernel list: ${response.data.msg}`);
676
+ }
677
+ };
678
+
679
+ // ../core/src/handlers/patch.ts
680
+ var patchHandlers = {
681
+ async updatePatch({ version_type }) {
682
+ const requestBody = {};
683
+ if (version_type) {
684
+ requestBody.version_type = version_type;
685
+ }
686
+ const response = await apiClient.post(`${LOCAL_API_BASE}${API_ENDPOINTS.UPDATE_PATCH}`, requestBody);
687
+ if (response.data.code === 0) {
688
+ return `Patch update status: ${JSON.stringify(response.data.data, null, 2)}, message: ${response.data.msg}`;
689
+ }
690
+ throw new Error(`Failed to update patch: ${response.data.msg}`);
691
+ }
692
+ };
693
+
590
694
  // ../core/src/types/schemas.ts
591
695
  var import_zod = require("zod");
592
696
  var userProxyConfigSchema = import_zod.z.object({
@@ -707,19 +811,365 @@ var randomUaConfigSchema = import_zod.z.object({
707
811
  ).optional().describe(
708
812
  'UA system version. Mac OS X / Windows / iOS / Android / Linux = random any version of that system; omit to random across all systems. e.g. ["Android 9", "iOS 14"] or ["Android", "Mac OS X"]'
709
813
  )
710
- }).optional().describe("The random ua config of the browser, default is ua_version: [], ua_system_version: []");
814
+ }).optional().describe("Random UA config (ua_version, ua_system_version). Ignored when fingerprint ua (custom UA) is set.");
815
+ var TLS_CIPHER_SUITES = {
816
+ TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384: "0xC02C",
817
+ TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384: "0xC030",
818
+ TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256: "0xC02B",
819
+ TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256: "0xC02F",
820
+ TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256: "0xCCA9",
821
+ TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256: "0xCCA8",
822
+ TLS_DHE_RSA_WITH_AES_256_GCM_SHA384: "0x009F",
823
+ TLS_DHE_RSA_WITH_AES_128_GCM_SHA256: "0x009E",
824
+ TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384: "0xC024",
825
+ TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384: "0xC028",
826
+ TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA: "0xC00A",
827
+ TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA: "0xC014",
828
+ TLS_DHE_RSA_WITH_AES_256_CBC_SHA256: "0x006B",
829
+ TLS_DHE_RSA_WITH_AES_256_CBC_SHA: "0x0039",
830
+ TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256: "0xC023",
831
+ TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256: "0xC027",
832
+ TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA: "0xC009",
833
+ TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA: "0xC013",
834
+ TLS_DHE_RSA_WITH_AES_128_CBC_SHA256: "0x0067",
835
+ TLS_DHE_RSA_WITH_AES_128_CBC_SHA: "0x0033",
836
+ TLS_RSA_WITH_AES_256_GCM_SHA384: "0x009D",
837
+ TLS_RSA_WITH_AES_128_GCM_SHA256: "0x009C",
838
+ TLS_RSA_WITH_AES_256_CBC_SHA256: "0x003D",
839
+ TLS_RSA_WITH_AES_128_CBC_SHA256: "0x003C",
840
+ TLS_RSA_WITH_AES_256_CBC_SHA: "0x0035",
841
+ TLS_RSA_WITH_AES_128_CBC_SHA: "0x002F",
842
+ TLS_AES_128_CCM_8_SHA256: "0x1305",
843
+ TLS_AES_128_CCM_SHA256: "0x1304"
844
+ };
845
+ var TLS_HEX_CODES = Object.values(TLS_CIPHER_SUITES);
846
+ var COUNTRY_CODES = [
847
+ "ad",
848
+ "ae",
849
+ "af",
850
+ "ag",
851
+ "ai",
852
+ "al",
853
+ "am",
854
+ "ao",
855
+ "aq",
856
+ "ar",
857
+ "as",
858
+ "at",
859
+ "au",
860
+ "aw",
861
+ "ax",
862
+ "az",
863
+ "ba",
864
+ "bb",
865
+ "bd",
866
+ "be",
867
+ "bf",
868
+ "bg",
869
+ "bh",
870
+ "bi",
871
+ "bj",
872
+ "bl",
873
+ "bm",
874
+ "bn",
875
+ "bo",
876
+ "bq",
877
+ "br",
878
+ "bs",
879
+ "bt",
880
+ "bv",
881
+ "bw",
882
+ "by",
883
+ "bz",
884
+ "ca",
885
+ "cc",
886
+ "cd",
887
+ "cf",
888
+ "cg",
889
+ "ch",
890
+ "ci",
891
+ "ck",
892
+ "cl",
893
+ "cm",
894
+ "cn",
895
+ "co",
896
+ "cr",
897
+ "cu",
898
+ "cv",
899
+ "cx",
900
+ "cy",
901
+ "cz",
902
+ "de",
903
+ "dj",
904
+ "dk",
905
+ "dm",
906
+ "do",
907
+ "dz",
908
+ "ec",
909
+ "ee",
910
+ "eg",
911
+ "eh",
912
+ "er",
913
+ "es",
914
+ "et",
915
+ "fi",
916
+ "fj",
917
+ "fk",
918
+ "fm",
919
+ "fo",
920
+ "fr",
921
+ "ga",
922
+ "gb",
923
+ "gd",
924
+ "ge",
925
+ "gf",
926
+ "gg",
927
+ "gh",
928
+ "gi",
929
+ "gl",
930
+ "gm",
931
+ "gn",
932
+ "gp",
933
+ "gq",
934
+ "gr",
935
+ "gs",
936
+ "gt",
937
+ "gu",
938
+ "gw",
939
+ "gy",
940
+ "hk",
941
+ "hm",
942
+ "hn",
943
+ "hr",
944
+ "ht",
945
+ "hu",
946
+ "id",
947
+ "ie",
948
+ "il",
949
+ "im",
950
+ "in",
951
+ "io",
952
+ "iq",
953
+ "ir",
954
+ "is",
955
+ "it",
956
+ "je",
957
+ "jm",
958
+ "jo",
959
+ "jp",
960
+ "ke",
961
+ "kg",
962
+ "kh",
963
+ "ki",
964
+ "km",
965
+ "kn",
966
+ "kp",
967
+ "kr",
968
+ "kw",
969
+ "ky",
970
+ "kz",
971
+ "la",
972
+ "lb",
973
+ "lc",
974
+ "li",
975
+ "lk",
976
+ "lr",
977
+ "ls",
978
+ "lt",
979
+ "lu",
980
+ "lv",
981
+ "ly",
982
+ "ma",
983
+ "mc",
984
+ "md",
985
+ "me",
986
+ "mf",
987
+ "mg",
988
+ "mh",
989
+ "mk",
990
+ "ml",
991
+ "mm",
992
+ "mn",
993
+ "mo",
994
+ "mp",
995
+ "mq",
996
+ "mr",
997
+ "ms",
998
+ "mt",
999
+ "mu",
1000
+ "mv",
1001
+ "mw",
1002
+ "mx",
1003
+ "my",
1004
+ "mz",
1005
+ "na",
1006
+ "nc",
1007
+ "ne",
1008
+ "nf",
1009
+ "ng",
1010
+ "ni",
1011
+ "nl",
1012
+ "no",
1013
+ "np",
1014
+ "nr",
1015
+ "nu",
1016
+ "nz",
1017
+ "om",
1018
+ "pa",
1019
+ "pe",
1020
+ "pf",
1021
+ "pg",
1022
+ "ph",
1023
+ "pk",
1024
+ "pl",
1025
+ "pm",
1026
+ "pn",
1027
+ "pr",
1028
+ "ps",
1029
+ "pt",
1030
+ "pw",
1031
+ "py",
1032
+ "qa",
1033
+ "re",
1034
+ "ro",
1035
+ "rs",
1036
+ "ru",
1037
+ "rw",
1038
+ "sa",
1039
+ "sb",
1040
+ "sc",
1041
+ "sd",
1042
+ "se",
1043
+ "sg",
1044
+ "sh",
1045
+ "si",
1046
+ "sj",
1047
+ "sk",
1048
+ "sl",
1049
+ "sm",
1050
+ "sn",
1051
+ "so",
1052
+ "sr",
1053
+ "ss",
1054
+ "st",
1055
+ "sv",
1056
+ "sy",
1057
+ "sz",
1058
+ "tc",
1059
+ "td",
1060
+ "tf",
1061
+ "tg",
1062
+ "th",
1063
+ "tj",
1064
+ "tk",
1065
+ "tl",
1066
+ "tm",
1067
+ "tn",
1068
+ "to",
1069
+ "tr",
1070
+ "tt",
1071
+ "tv",
1072
+ "tw",
1073
+ "tz",
1074
+ "ua",
1075
+ "ug",
1076
+ "um",
1077
+ "us",
1078
+ "uy",
1079
+ "uz",
1080
+ "va",
1081
+ "vc",
1082
+ "ve",
1083
+ "vg",
1084
+ "vi",
1085
+ "vn",
1086
+ "vu",
1087
+ "wf",
1088
+ "ws",
1089
+ "ye",
1090
+ "yt",
1091
+ "za",
1092
+ "zm",
1093
+ "zw"
1094
+ ];
1095
+ var countryCodeSchema = import_zod.z.enum(COUNTRY_CODES);
1096
+ var webglConfigSchema = import_zod.z.object({
1097
+ unmasked_vendor: import_zod.z.string().describe('WebGL vendor string, e.g. "Google Inc.". Required when webgl=2, cannot be empty.'),
1098
+ unmasked_renderer: import_zod.z.string().describe('WebGL renderer string, e.g. "ANGLE (Intel(R) HD Graphics 620 Direct3D11 vs_5_0 ps_5_0)". Required when webgl=2, cannot be empty.'),
1099
+ webgpu: import_zod.z.object({
1100
+ webgpu_switch: import_zod.z.enum(["0", "1", "2"]).describe("0: Disabled, 1: WebGL based matching, 2: Real")
1101
+ }).optional().describe("WebGPU setting (V2.6.8.1+)")
1102
+ }).describe("Custom WebGL metadata when webgl=2. See AdsPower fingerprint_config webgl_config.");
1103
+ var macAddressConfigSchema = import_zod.z.object({
1104
+ model: import_zod.z.enum(["0", "1", "2"]).describe("0: use current computer MAC, 1: match appropriate value, 2: custom (address required)"),
1105
+ address: import_zod.z.string().optional().describe('Custom MAC address when model=2, e.g. "E4-02-9B-3B-E9-27"')
1106
+ }).describe("MAC address: model 0/1/2, address when model=2.");
1107
+ var DEVICE_COUNT_VALUES = ["1", "2", "3", "4", "5", "6", "7", "8", "9"];
1108
+ var mediaDevicesNumSchema = import_zod.z.object({
1109
+ audioinput_num: import_zod.z.enum(DEVICE_COUNT_VALUES).describe("Number of microphones, 1-9"),
1110
+ videoinput_num: import_zod.z.enum(DEVICE_COUNT_VALUES).describe("Number of cameras, 1-9"),
1111
+ audiooutput_num: import_zod.z.enum(DEVICE_COUNT_VALUES).describe("Number of speakers, 1-9")
1112
+ }).describe("Device counts when media_devices=2: audioinput_num, videoinput_num, audiooutput_num each 1-9.");
711
1113
  var fingerprintConfigSchema = import_zod.z.object({
712
- automatic_timezone: import_zod.z.enum(["0", "1"]).optional().describe("The automatic timezone of the browser, default is 0"),
713
- timezone: import_zod.z.string().optional().describe("The timezone of the browser, eg: Asia/Shanghai"),
714
- language: import_zod.z.array(import_zod.z.string()).optional().describe('The language of the browser, eg: ["en-US", "zh-CN"]'),
715
- flash: import_zod.z.enum(["block", "allow"]).optional().describe("The flash of the browser, default is disabled"),
716
- fonts: import_zod.z.array(import_zod.z.string()).optional().describe('The fonts of the browser, eg: ["Arial", "Times New Roman"]'),
717
- webrtc: import_zod.z.enum(["disabled", "forward", "proxy", "local"]).optional().describe("The webrtc of the browser, default is disabled"),
718
- browser_kernel_config: browserKernelConfigSchema,
719
- random_ua: randomUaConfigSchema,
720
- tls_switch: import_zod.z.enum(["0", "1"]).optional().describe("The tls switch of the browser, default is 0"),
721
- tls: import_zod.z.string().optional().describe('The tls of the browser, if tls_switch is 1, you can set the tls of the browser, eg: "0xC02C,0xC030"')
722
- }).optional().describe('The fingerprint config of the browser, default is automatic_timezone: 0, timezone: "", language: [], flash: "", fonts: [], webrtc: disabled, browser_kernel_config: ua_auto, random_ua: ua_version: [], ua_system_version: [], tls_switch: 0, tls: ""');
1114
+ automatic_timezone: import_zod.z.enum(["0", "1"]).optional().describe("Auto timezone by IP: 0 custom, 1 (default) by IP"),
1115
+ timezone: import_zod.z.string().optional().describe("Timezone when automatic_timezone=0, e.g. Asia/Shanghai"),
1116
+ location_switch: import_zod.z.enum(["0", "1"]).optional().describe("Location by IP: 0 custom, 1 (default) by IP"),
1117
+ longitude: import_zod.z.number().min(-180).max(180).optional().describe("Custom longitude when location_switch=0, -180 to 180, up to 6 decimals"),
1118
+ latitude: import_zod.z.number().min(-90).max(90).optional().describe("Custom latitude when location_switch=0, -90 to 90, up to 6 decimals"),
1119
+ accuracy: import_zod.z.number().int().min(10).max(5e3).optional().describe("Location accuracy in meters when location_switch=0, 10-5000, default 1000"),
1120
+ location: import_zod.z.enum(["ask", "allow", "block"]).optional().describe("Site location permission: ask (default), allow, block"),
1121
+ language_switch: import_zod.z.enum(["0", "1"]).optional().describe("Language by IP country: 0 custom, 1 (default) by IP"),
1122
+ language: import_zod.z.array(import_zod.z.string()).optional().describe('Custom languages when language_switch=0, e.g. ["en-US", "zh-CN"]'),
1123
+ page_language_switch: import_zod.z.enum(["0", "1"]).optional().describe("Match UI language to language: 0 off, 1 (default) on; Chrome 109+ Win / 119+ macOS, v2.6.72+"),
1124
+ page_language: import_zod.z.string().optional().describe("Page language when page_language_switch=0, e.g. en-US"),
1125
+ ua: import_zod.z.string().optional().describe("Custom User-Agent string; when set, takes precedence over random_ua (random_ua is not sent). Omit for random UA."),
1126
+ screen_resolution: import_zod.z.union([
1127
+ import_zod.z.enum(["none", "random"]),
1128
+ import_zod.z.string().regex(/^\d+_\d+$/, "Custom resolution format: width_height e.g. 1024_600")
1129
+ ]).optional().describe("Screen resolution: none (default), random, or width_height e.g. 1024_600"),
1130
+ fonts: import_zod.z.array(import_zod.z.string()).optional().describe('Font list e.g. ["Arial", "Times New Roman"] or ["all"]'),
1131
+ canvas: import_zod.z.enum(["0", "1"]).optional().describe("Canvas fingerprint: 0 computer default, 1 (default) add noise"),
1132
+ webgl: import_zod.z.enum(["0", "2", "3"]).optional().describe("WebGL metadata: 0 computer default, 2 custom (use webgl_config), 3 random"),
1133
+ webgl_image: import_zod.z.enum(["0", "1"]).optional().describe("WebGL image fingerprint: 0 default, 1 (default) add noise"),
1134
+ webgl_config: webglConfigSchema.optional().describe("Custom WebGL metadata when webgl=2. Must include unmasked_vendor and unmasked_renderer (non-empty). webgpu.webgpu_switch: 0 Disabled, 1 WebGL based, 2 Real. V2.6.8.1+"),
1135
+ flash: import_zod.z.enum(["block", "allow"]).optional().describe("Flash: block (default) or allow"),
1136
+ webrtc: import_zod.z.enum(["disabled", "forward", "proxy", "local"]).optional().describe("WebRTC: disabled (default), forward, proxy, local"),
1137
+ audio: import_zod.z.enum(["0", "1"]).optional().describe("Audio fingerprint: 0 close, 1 (default) add noise"),
1138
+ do_not_track: import_zod.z.enum(["default", "true", "false"]).optional().describe("Do Not Track: default, true (open), false (close)"),
1139
+ hardware_concurrency: import_zod.z.enum(["2", "4", "6", "8", "16"]).optional().describe("CPU cores: 2, 4 (default if omitted), 6, 8, 16; omit to follow current computer"),
1140
+ device_memory: import_zod.z.enum(["2", "4", "6", "8"]).optional().describe("Device memory (GB): 2, 4, 6, 8 (default if omitted); omit to follow current computer"),
1141
+ scan_port_type: import_zod.z.enum(["0", "1"]).optional().describe("Port scan protection: 0 close, 1 (default) enable"),
1142
+ allow_scan_ports: import_zod.z.array(import_zod.z.string()).optional().describe('Ports allowed when scan_port_type=1, e.g. ["4000","4001"]. Empty to not pass.'),
1143
+ media_devices: import_zod.z.enum(["0", "1", "2"]).optional().describe("Media devices: 0 off (use computer default), 1 noise (count follows local), 2 noise (use media_devices_num). V2.6.4.2+"),
1144
+ media_devices_num: mediaDevicesNumSchema.optional().describe("When media_devices=2: audioinput_num, videoinput_num, audiooutput_num each 1-9. V2.6.4.2+"),
1145
+ client_rects: import_zod.z.enum(["0", "1"]).optional().describe("ClientRects: 0 use computer default, 1 add noise. V3.6.2+"),
1146
+ device_name_switch: import_zod.z.enum(["0", "1", "2"]).optional().describe("Device name: 0 close (use computer name), 1 mask, 2 custom (use device_name). V3.6.25+"),
1147
+ device_name: import_zod.z.string().optional().describe("Custom device name when device_name_switch=2. V2.4.8.1+"),
1148
+ speech_switch: import_zod.z.enum(["0", "1"]).optional().describe("SpeechVoices: 0 use computer default, 1 replace with value. V3.11.10+"),
1149
+ mac_address_config: macAddressConfigSchema.optional().describe("MAC address: model 0/1/2, address when model=2. V4.3.9+"),
1150
+ gpu: import_zod.z.enum(["0", "1", "2"]).optional().describe("GPU: 0 follow Local settings - Hardware acceleration, 1 turn on, 2 turn off"),
1151
+ browser_kernel_config: browserKernelConfigSchema.optional(),
1152
+ random_ua: randomUaConfigSchema.optional().describe("Random UA config; ignored when ua (custom UA) is provided."),
1153
+ tls_switch: import_zod.z.enum(["0", "1"]).optional().describe("TLS custom list: 0 (default) off, 1 on"),
1154
+ tls: import_zod.z.string().optional().refine(
1155
+ (val) => !val || val.split(",").every((hex) => TLS_HEX_CODES.includes(hex.trim())),
1156
+ { message: `tls must be comma-separated hex codes from: ${TLS_HEX_CODES.join(", ")}. e.g. "0xC02C,0xC030"` }
1157
+ ).describe("TLS cipher list when tls_switch=1: comma-separated hex codes. Chrome kernel only.")
1158
+ }).optional().superRefine((data, ctx) => {
1159
+ if (!data) return;
1160
+ if (data.browser_kernel_config?.type === "firefox" && data.tls) {
1161
+ ctx.addIssue({ code: import_zod.z.ZodIssueCode.custom, message: "tls is only supported for Chrome kernel", path: ["tls"] });
1162
+ }
1163
+ if (data.webgl === "2") {
1164
+ const wc = data.webgl_config;
1165
+ if (!wc || typeof wc.unmasked_vendor !== "string" || wc.unmasked_vendor.trim() === "") {
1166
+ ctx.addIssue({ code: import_zod.z.ZodIssueCode.custom, message: "When webgl=2, webgl_config.unmasked_vendor is required and cannot be empty", path: ["webgl_config", "unmasked_vendor"] });
1167
+ }
1168
+ if (!wc || typeof wc.unmasked_renderer !== "string" || wc.unmasked_renderer.trim() === "") {
1169
+ ctx.addIssue({ code: import_zod.z.ZodIssueCode.custom, message: "When webgl=2, webgl_config.unmasked_renderer is required and cannot be empty", path: ["webgl_config", "unmasked_renderer"] });
1170
+ }
1171
+ }
1172
+ }).describe("Fingerprint config (fingerprint_config). All fields optional. See AdsPower Local API fingerprint_config.");
723
1173
  var schemas = {
724
1174
  createBrowserSchema: import_zod.z.object({
725
1175
  groupId: import_zod.z.string().regex(/^\d+$/, "Group ID must be a numeric string").describe('The group id of the browser, must be a numeric string (e.g., "123"). You can use the get-group-list tool to get the group list or create a new group, use 0 for Ungrouped'),
@@ -730,22 +1180,19 @@ var schemas = {
730
1180
  name: import_zod.z.string().max(100).optional().describe("Account name, max 100 characters"),
731
1181
  platform: import_zod.z.string().optional().describe("Platform domain, eg: facebook.com"),
732
1182
  remark: import_zod.z.string().optional().describe("Remarks to describe the account. Maximum 1500 characters."),
733
- userProxyConfig: userProxyConfigSchema.optional().describe("Either user_proxy_config or proxyid must be provided. Only one is required."),
734
- proxyid: import_zod.z.string().optional().describe("Either user_proxy_config or proxyid must be provided. Only one is required."),
1183
+ userProxyConfig: userProxyConfigSchema.default({ proxy_soft: "no_proxy" }).describe("Proxy configuration. If proxyid is provided, proxyid takes priority and this field is ignored. Defaults to no_proxy when neither proxyid nor a custom proxy is needed."),
1184
+ proxyid: import_zod.z.string().optional().describe("Proxy profile ID. Takes priority over userProxyConfig when provided."),
735
1185
  repeatConfig: import_zod.z.array(import_zod.z.union([import_zod.z.literal(0), import_zod.z.literal(2), import_zod.z.literal(3), import_zod.z.literal(4)])).optional().describe("Account deduplication settings (0, 2, 3, or 4)"),
736
1186
  ignoreCookieError: import_zod.z.enum(["0", "1"]).optional().describe("Handle cookie verification failures: 0 (default) return data as-is, 1 filter out incorrectly formatted cookies"),
737
1187
  tabs: import_zod.z.array(import_zod.z.string()).optional().describe('URLs to open on startup, eg: ["https://www.google.com"]'),
738
1188
  ip: import_zod.z.string().optional().describe("IP address"),
739
- country: import_zod.z.string().optional().describe('Country/Region, eg: "CN"'),
1189
+ country: countryCodeSchema.optional().describe('Country/Region, ISO 3166-1 alpha-2 (lowercase). eg: "cn", "us"'),
740
1190
  region: import_zod.z.string().optional().describe("Region"),
741
1191
  city: import_zod.z.string().optional().describe("City"),
742
1192
  ipchecker: import_zod.z.enum(["ip2location", "ipapi"]).optional().describe("IP query channel"),
743
1193
  categoryId: import_zod.z.string().optional().describe("The category id of the browser, you can use the get-application-list tool to get the application list"),
744
- fingerprintConfig: fingerprintConfigSchema.optional()
745
- }).refine((data) => data.userProxyConfig || data.proxyid, {
746
- message: "Either userProxyConfig or proxyid must be provided"
747
- }).refine((data) => data.username || data.password || data.cookie || data.fakey, {
748
- message: "At least one account information field (username, password, cookie, or fakey) must be provided"
1194
+ profileTagIds: import_zod.z.array(import_zod.z.string()).max(30).optional().describe('Tag IDs to assign to the profile, max 30 tags per profile. Example: ["tag1","tag2"]'),
1195
+ fingerprintConfig: fingerprintConfigSchema.optional().default({ random_ua: { ua_system_version: ["Windows"] } })
749
1196
  }),
750
1197
  updateBrowserSchema: import_zod.z.object({
751
1198
  platform: import_zod.z.string().optional().describe("The platform of the browser, eg: facebook.com"),
@@ -758,7 +1205,7 @@ var schemas = {
758
1205
  groupId: import_zod.z.string().optional().describe('The group id of the browser, must be a numeric string (e.g., "123"). You can use the get-group-list tool to get the group list or create a new group'),
759
1206
  name: import_zod.z.string().max(100).optional().describe('The Profile name of the browser, eg: "My Browser"'),
760
1207
  remark: import_zod.z.string().max(1500).optional().describe("Profile remarks, maximum 1500 characters"),
761
- country: import_zod.z.string().optional().describe('The country of the browser, eg: "CN"'),
1208
+ country: countryCodeSchema.optional().describe('The country of the browser, ISO 3166-1 alpha-2 (lowercase). eg: "cn", "us"'),
762
1209
  region: import_zod.z.string().optional().describe("The region of the browser"),
763
1210
  city: import_zod.z.string().optional().describe("The city of the browser"),
764
1211
  ip: import_zod.z.string().optional().describe("The IP of the browser"),
@@ -767,6 +1214,8 @@ var schemas = {
767
1214
  proxyid: import_zod.z.string().optional().describe("Proxy ID"),
768
1215
  fingerprintConfig: fingerprintConfigSchema.optional(),
769
1216
  launchArgs: import_zod.z.string().optional().describe("Browser startup parameters"),
1217
+ profileTagIds: import_zod.z.array(import_zod.z.string()).max(30).optional().describe('Tag IDs to set on the profile, max 30 tags per profile. Example: ["tag1","tag2"]'),
1218
+ tagsUpdateType: import_zod.z.enum(["1", "2"]).optional().describe('How to apply profile_tag_ids: "1" (default) replace all existing tags; "2" append tags (truncated to 30 total if exceeded)'),
770
1219
  profileId: import_zod.z.string().describe("The profile id of the browser to update, it is required when you want to update the browser")
771
1220
  }),
772
1221
  openBrowserSchema: import_zod.z.object({
@@ -793,7 +1242,11 @@ var schemas = {
793
1242
  profileId: import_zod.z.array(import_zod.z.string()).optional().describe('Query by profile ID. Example: ["h1yynkm","h1yynks"]'),
794
1243
  profileNo: import_zod.z.array(import_zod.z.string()).optional().describe('Query by profile number. Example: ["123","124"]'),
795
1244
  sortType: import_zod.z.enum(["profile_no", "last_open_time", "created_time"]).optional().describe("Sort results by: profile_no, last_open_time, or created_time"),
796
- sortOrder: import_zod.z.enum(["asc", "desc"]).optional().describe('Sort order: "asc" (ascending) or "desc" (descending)')
1245
+ sortOrder: import_zod.z.enum(["asc", "desc"]).optional().describe('Sort order: "asc" (ascending) or "desc" (descending)'),
1246
+ tag_ids: import_zod.z.array(import_zod.z.string()).optional().describe('Tag IDs to filter profiles by tags. Example: ["tag1","tag2"]'),
1247
+ tags_filter: import_zod.z.enum(["include", "exclude"]).optional().describe('Tag matching mode: "include" (default) matches profiles with any of the tags, "exclude" matches profiles without the tags'),
1248
+ name: import_zod.z.string().optional().describe("Profile name keyword to search for"),
1249
+ name_filter: import_zod.z.enum(["include", "exclude"]).optional().describe('Name matching mode: "include" (default) matches profiles containing the name keyword, "exclude" matches profiles not containing the name keyword')
797
1250
  }).strict(),
798
1251
  moveBrowserSchema: import_zod.z.object({
799
1252
  groupId: import_zod.z.string().regex(/^\d+$/, "Group ID must be a numeric string").describe('The target group id, must be a numeric string (e.g., "123"). You can use the get-group-list tool to get the group list'),
@@ -865,7 +1318,7 @@ var schemas = {
865
1318
  password: import_zod.z.string().optional().describe("Proxy password, eg: password"),
866
1319
  proxy_url: import_zod.z.string().optional().describe("URL used to refresh the proxy, eg: https://www.baidu.com/"),
867
1320
  remark: import_zod.z.string().optional().describe("Remark/description for the proxy"),
868
- ipchecker: import_zod.z.enum(["ipinfo", "ip2location", "ipapi", "ipfoxy", "ipidea"]).optional().describe("IP checker.")
1321
+ ipchecker: import_zod.z.enum(["ipinfo", "ip2location", "ipapi", "ipfoxy"]).optional().describe("IP checker.")
869
1322
  }).strict()).describe("Array of proxy configurations to create")
870
1323
  }).strict(),
871
1324
  updateProxySchema: import_zod.z.object({
@@ -877,7 +1330,7 @@ var schemas = {
877
1330
  password: import_zod.z.string().optional().describe("Proxy password, eg: password"),
878
1331
  proxyUrl: import_zod.z.string().optional().describe("URL used to refresh the proxy, eg: https://www.baidu.com/"),
879
1332
  remark: import_zod.z.string().optional().describe("Remark/description for the proxy"),
880
- ipchecker: import_zod.z.enum(["ip2location", "ipapi", "ipfoxy", "ipidea"]).optional().describe("IP checker.")
1333
+ ipchecker: import_zod.z.enum(["ip2location", "ipapi", "ipfoxy"]).optional().describe("IP checker.")
881
1334
  }).strict(),
882
1335
  getProxyListSchema: import_zod.z.object({
883
1336
  limit: import_zod.z.number().optional().describe("Profiles per page. Number of proxies returned per page, range 1 ~ 200, default is 50"),
@@ -887,6 +1340,37 @@ var schemas = {
887
1340
  deleteProxySchema: import_zod.z.object({
888
1341
  proxyIds: import_zod.z.array(import_zod.z.string()).describe("The proxy ids of the proxies to delete, it is required when you want to delete the proxy. The maximum is 100. ")
889
1342
  }).strict(),
1343
+ getTagListSchema: import_zod.z.object({
1344
+ ids: import_zod.z.array(import_zod.z.string()).optional().describe('Tag IDs to query, max 100 per request. Example: ["tag1","tag2"]'),
1345
+ limit: import_zod.z.number().optional().describe("Number of tags returned per page, range 1 ~ 200, default is 50"),
1346
+ page: import_zod.z.number().optional().describe("Page number for results, default is 1")
1347
+ }).strict(),
1348
+ createTagSchema: import_zod.z.object({
1349
+ tags: import_zod.z.array(import_zod.z.object({
1350
+ name: import_zod.z.string().max(50).describe("Tag name, max 50 characters"),
1351
+ color: import_zod.z.enum(["darkBlue", "blue", "purple", "red", "yellow", "orange", "green", "lightGreen"]).optional().describe("Tag color, default is darkBlue")
1352
+ }).strict()).describe("Array of tags to create")
1353
+ }).strict(),
1354
+ updateTagSchema: import_zod.z.object({
1355
+ tags: import_zod.z.array(import_zod.z.object({
1356
+ id: import_zod.z.string().describe("Tag ID to update"),
1357
+ name: import_zod.z.string().max(50).optional().describe("Tag name, max 50 characters"),
1358
+ color: import_zod.z.enum(["darkBlue", "blue", "purple", "red", "yellow", "orange", "green", "lightGreen"]).optional().describe("Tag color")
1359
+ }).strict()).describe("Array of tags to update")
1360
+ }).strict(),
1361
+ deleteTagSchema: import_zod.z.object({
1362
+ ids: import_zod.z.array(import_zod.z.string()).describe("Tag IDs to delete")
1363
+ }).strict(),
1364
+ downloadKernelSchema: import_zod.z.object({
1365
+ kernel_type: import_zod.z.enum(["Chrome", "Firefox"]).describe("Browser kernel type"),
1366
+ kernel_version: import_zod.z.string().describe("Browser kernel version, e.g. 141")
1367
+ }).strict(),
1368
+ getKernelListSchema: import_zod.z.object({
1369
+ kernel_type: import_zod.z.enum(["Chrome", "Firefox"]).optional().describe("Browser kernel type; omit to return all supported kernels")
1370
+ }).strict(),
1371
+ updatePatchSchema: import_zod.z.object({
1372
+ version_type: import_zod.z.enum(["stable", "beta"]).optional().describe("Patch version type to update, default stable")
1373
+ }).strict(),
890
1374
  emptySchema: import_zod.z.object({}).strict(),
891
1375
  createAutomationSchema: import_zod.z.object({
892
1376
  userId: import_zod.z.string().optional().describe("The browser id of the browser to connect"),
@@ -960,7 +1444,14 @@ var STATELESS_HANDLERS = {
960
1444
  "create-proxy": proxyHandlers.createProxy,
961
1445
  "update-proxy": proxyHandlers.updateProxy,
962
1446
  "get-proxy-list": proxyHandlers.getProxyList,
963
- "delete-proxy": proxyHandlers.deleteProxy
1447
+ "delete-proxy": proxyHandlers.deleteProxy,
1448
+ "get-tag-list": tagHandlers.getTagList,
1449
+ "create-tag": tagHandlers.createTag,
1450
+ "update-tag": tagHandlers.updateTag,
1451
+ "delete-tag": tagHandlers.deleteTag,
1452
+ "download-kernel": kernelHandlers.downloadKernel,
1453
+ "get-kernel-list": kernelHandlers.getKernelList,
1454
+ "update-patch": patchHandlers.updatePatch
964
1455
  };
965
1456
  var SINGLE_PROFILE_ID_COMMANDS = {
966
1457
  "open-browser": "profileId",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "adspower-browser",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "main": "build/cli.js",
5
5
  "type": "commonjs",
6
6
  "bin": {