ffapis 1.5.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.
@@ -0,0 +1,352 @@
1
+ import protobuf from 'protobufjs';
2
+
3
+ interface Session {
4
+ token: string | null;
5
+ serverUrl: string | null;
6
+ openId: string | null;
7
+ accountId: string | null;
8
+ }
9
+ interface Credential {
10
+ uid: string;
11
+ password: string;
12
+ }
13
+ interface GarenaTokenResponse {
14
+ access_token: string;
15
+ open_id: string;
16
+ }
17
+ interface GarenaGuestRegisterResponse {
18
+ uid: string;
19
+ }
20
+ interface MajorLoginResponse {
21
+ token: string;
22
+ serverUrl: string;
23
+ accountid: string;
24
+ }
25
+ interface SearchResult {
26
+ accountid: string;
27
+ nickname: string;
28
+ level: number;
29
+ }
30
+ interface RegisterResult {
31
+ uid: string;
32
+ password: string;
33
+ passwordHash: string;
34
+ region: string;
35
+ nickname: string;
36
+ }
37
+ interface LikeResult {
38
+ success: boolean;
39
+ successCount: number;
40
+ failedCount: number;
41
+ remainingGuests: number;
42
+ message: string;
43
+ }
44
+ interface AEConfig {
45
+ MAIN_KEY: Buffer;
46
+ MAIN_IV: Buffer;
47
+ }
48
+ interface HeadersConfig {
49
+ COMMON: Record<string, string>;
50
+ GARENA_AUTH: Record<string, string>;
51
+ }
52
+ interface URLSConfig {
53
+ GARENA_TOKEN: string;
54
+ GUEST_REGISTER: string;
55
+ MAJOR_LOGIN: string;
56
+ MAJOR_REGISTER: string;
57
+ SEARCH: (serverUrl: string) => string;
58
+ PERSONAL_SHOW: (serverUrl: string) => string;
59
+ PLAYER_STATS: (serverUrl: string) => string;
60
+ PLAYER_CS_STATS: (serverUrl: string) => string;
61
+ }
62
+ interface GarenaClientConfig {
63
+ CLIENT_ID: string;
64
+ CLIENT_SECRET: string;
65
+ }
66
+ interface Settings {
67
+ AE: AEConfig;
68
+ HEADERS: HeadersConfig;
69
+ URLS: URLSConfig;
70
+ GARENA_CLIENT: GarenaClientConfig;
71
+ }
72
+ interface ItemDetails {
73
+ id: number;
74
+ name: string;
75
+ type: string;
76
+ rarity: string;
77
+ description: string;
78
+ is_unique: boolean;
79
+ image: string;
80
+ image_fallback: string;
81
+ collection_type?: string;
82
+ icon_code?: string;
83
+ }
84
+ interface PlayerBasicInfo {
85
+ accountid: string;
86
+ nickname: string;
87
+ level: number;
88
+ exp: number;
89
+ region: string;
90
+ liked: string;
91
+ signature: string;
92
+ createat: number;
93
+ lastloginat: number;
94
+ weaponskinshows: number[];
95
+ }
96
+ interface PlayerClanInfo {
97
+ clanname: string;
98
+ clanid: string;
99
+ }
100
+ interface PlayerPetInfo {
101
+ id: number;
102
+ name: string;
103
+ level: number;
104
+ skinid: number;
105
+ selectedskillid: number;
106
+ }
107
+ interface PlayerProfileInfo {
108
+ clothes: number[];
109
+ equipedskills: number[];
110
+ }
111
+ interface PlayerProfile {
112
+ basicinfo: PlayerBasicInfo;
113
+ claninfo?: PlayerClanInfo;
114
+ petinfo?: PlayerPetInfo;
115
+ profileinfo: PlayerProfileInfo;
116
+ }
117
+ interface PlayerStats {
118
+ solostats?: Record<string, unknown>;
119
+ duostats?: Record<string, unknown>;
120
+ quadstats?: Record<string, unknown>;
121
+ }
122
+ interface ProcessedPlayerItems {
123
+ basic_info: {
124
+ accountid: string;
125
+ nickname: string;
126
+ level: number;
127
+ region: string;
128
+ liked: string;
129
+ signature: string;
130
+ };
131
+ items: {
132
+ outfit: ItemDetails[];
133
+ skills: {
134
+ equipped: ItemDetails[];
135
+ };
136
+ weapons: {
137
+ shown_skins: ItemDetails[];
138
+ };
139
+ pet: {
140
+ id: ItemDetails;
141
+ name: string;
142
+ level: number;
143
+ skin: ItemDetails;
144
+ selected_skill: ItemDetails;
145
+ } | null;
146
+ };
147
+ }
148
+ declare function getErrorMessage(error: unknown): string;
149
+
150
+ /**
151
+ * Manages a pool of guest credentials for a specific Free Fire region.
152
+ * Tracks usage to prevent reusing the same guest account on the same target.
153
+ */
154
+ declare class CredentialManager {
155
+ region: string;
156
+ private pool;
157
+ private currentIndex;
158
+ private usageData;
159
+ /**
160
+ * @param region - Region code whose credential YAML file will be loaded.
161
+ */
162
+ constructor(region: string);
163
+ private _loadPool;
164
+ isUsedForTarget(targetUid: string, guestUid: string): boolean;
165
+ markUsed(targetUid: string, guestUid: string): void;
166
+ getRandomCredential(): Credential | null;
167
+ getNextCredential(): Credential | null;
168
+ getNextForTarget(targetUid: string): Credential | null;
169
+ getMultipleForTarget(targetUid: string, count: number): Credential[];
170
+ getAvailableCount(targetUid: string): number;
171
+ getPoolSize(): number;
172
+ clearUsage(targetUid?: string): void;
173
+ }
174
+
175
+ /**
176
+ * Main API client for interacting with the Free Fire game servers.
177
+ * Handles authentication, player lookup, stats retrieval, and account registration.
178
+ */
179
+ declare class FreeFireAPI {
180
+ session: Session;
181
+ region: string | null;
182
+ credentialManager: CredentialManager | null;
183
+ private allCredentials;
184
+ /**
185
+ * Creates a new FreeFireAPI instance.
186
+ * @param region - Optional region code (e.g., 'IND', 'BR') to scope credential lookup.
187
+ */
188
+ constructor(region?: string | null);
189
+ /**
190
+ * Switches the active region and initializes a new credential manager.
191
+ * @param region - Region code to switch to.
192
+ */
193
+ setRegion(region: string): void;
194
+ private _loadAllCredentials;
195
+ private _getRandomCredentialFromAll;
196
+ /**
197
+ * Logs in using a random credential from any available region pool.
198
+ * @returns A valid session containing token, server URL, and account details.
199
+ */
200
+ loginWithRandomCredentialFromAll(): Promise<Session>;
201
+ /**
202
+ * Logs in using a random credential from the currently set region pool.
203
+ * Falls back to all-region lookup if no region is configured.
204
+ * @returns A valid session containing token, server URL, and account details.
205
+ */
206
+ loginWithRandomCredential(): Promise<Session>;
207
+ /**
208
+ * Authenticates with a specific UID and password.
209
+ * @param uid - Garena account UID.
210
+ * @param password - Account password.
211
+ * @returns A valid session containing token, server URL, and account details.
212
+ */
213
+ login(uid: string, password: string): Promise<Session>;
214
+ private _getGarenaToken;
215
+ private _majorLogin;
216
+ /**
217
+ * Searches for players by nickname across Free Fire servers.
218
+ * @param keyword - Player nickname to search (minimum 3 characters).
219
+ * @returns Array of matching player results.
220
+ */
221
+ searchAccount(keyword: string): Promise<SearchResult[]>;
222
+ /**
223
+ * Retrieves detailed profile information for a player.
224
+ * @param uid - Target player UID.
225
+ * @returns Structured player profile including basic info, clan, and pet data.
226
+ */
227
+ getPlayerProfile(uid: number | string): Promise<PlayerProfile>;
228
+ private _requestProfile;
229
+ /**
230
+ * Fetches and processes a player's equipped items (outfit, weapons, skills, pet).
231
+ * @param uid - Target player UID.
232
+ * @returns Normalized item details mapped from the internal items database.
233
+ */
234
+ getPlayerItems(uid: number | string): Promise<ProcessedPlayerItems | null>;
235
+ /**
236
+ * Retrieves match statistics for a player.
237
+ * @param uid - Target player UID.
238
+ * @param mode - Game mode: 'br' (Battle Royale) or 'cs' (Clash Squad).
239
+ * @param matchType - Match type: 'career', 'ranked', or 'normal'.
240
+ * @returns Structured stats object for solo, duo, and squad matches.
241
+ */
242
+ getPlayerStats(uid: number | string, mode?: 'br' | 'cs', matchType?: 'career' | 'ranked' | 'normal'): Promise<PlayerStats>;
243
+ private _checkSession;
244
+ /**
245
+ * Registers a new guest account in the specified region.
246
+ * @param region - Target region code (e.g., 'IND').
247
+ * @param nickname - Optional nickname; a random one is generated if omitted.
248
+ * @returns Registration result containing UID, password, and region.
249
+ */
250
+ register(region: string, nickname?: string | null): Promise<RegisterResult>;
251
+ private _generateRandomPassword;
252
+ private _guestRegister;
253
+ private _getGarenaTokenForRegister;
254
+ private _xorEncryptOpenId;
255
+ private _encodeVarint;
256
+ private _encodeField;
257
+ private _manualProtobufEncode;
258
+ private _majorRegister;
259
+ private _manualProtobufDecode;
260
+ }
261
+
262
+ /**
263
+ * API client for sending profile likes to a target Free Fire player.
264
+ * Manages guest credential pools per region and rotates through them.
265
+ */
266
+ declare class LikeAPI {
267
+ private credentialManagers;
268
+ private _getCredentialManager;
269
+ private _getBaseUrl;
270
+ private _login;
271
+ private _createLikePayload;
272
+ private _sendLikeWithGuest;
273
+ /**
274
+ * Sends likes to a target player using available guest accounts.
275
+ * @param targetUid - UID of the player to receive likes.
276
+ * @param region - Region code (e.g., 'IND', 'BR').
277
+ * @param likeCount - Number of likes to send (default 100, max 100 per day).
278
+ * @returns Summary of the like operation including success and failure counts.
279
+ */
280
+ sendLikes(targetUid: string, region: string, likeCount?: number): Promise<LikeResult>;
281
+ }
282
+
283
+ declare class ProtoHandler {
284
+ private roots;
285
+ load(filename: string): Promise<protobuf.Root>;
286
+ encode(filename: string, messageName: string, payload: Record<string, unknown>, shouldEncrypt?: boolean): Promise<Buffer>;
287
+ decode(filename: string, messageName: string, buffer: Buffer | ArrayBuffer): Promise<unknown>;
288
+ }
289
+ declare const protoHandler: ProtoHandler;
290
+
291
+ declare function encrypt(buffer: Buffer): Buffer;
292
+
293
+ declare function loadItems(): Record<string, Record<string, unknown>>;
294
+ declare function getItemDetails(itemId: number): ItemDetails;
295
+ declare function processPlayerItems(playerData: PlayerProfile): ProcessedPlayerItems;
296
+
297
+ interface AIToolParameterProperty {
298
+ type: string;
299
+ description: string;
300
+ enum?: string[];
301
+ minimum?: number;
302
+ maximum?: number;
303
+ minLength?: number;
304
+ }
305
+ interface AIToolParameters {
306
+ type: 'object';
307
+ properties: Record<string, AIToolParameterProperty>;
308
+ required: string[];
309
+ }
310
+ interface AITool {
311
+ type: 'function';
312
+ function: {
313
+ name: string;
314
+ description: string;
315
+ parameters: AIToolParameters;
316
+ };
317
+ }
318
+ declare const freefireTools: AITool[];
319
+ declare function getToolByName(name: string): AITool | undefined;
320
+ declare function getToolNames(): string[];
321
+
322
+ interface AIToolCall {
323
+ id: string;
324
+ type: 'function';
325
+ function: {
326
+ name: string;
327
+ arguments: string;
328
+ };
329
+ }
330
+ interface AIToolCallResult {
331
+ tool_call_id: string;
332
+ role: 'tool';
333
+ name: string;
334
+ content: string;
335
+ }
336
+ interface AIHandlerOptions {
337
+ region?: string;
338
+ }
339
+ declare class FreeFireAIToolHandler {
340
+ private api;
341
+ private likeApi;
342
+ constructor(options?: AIHandlerOptions);
343
+ execute(toolCall: AIToolCall): Promise<AIToolCallResult>;
344
+ executeMany(toolCalls: AIToolCall[]): Promise<AIToolCallResult[]>;
345
+ private _dispatch;
346
+ private _buildResult;
347
+ private _sanitizeProfile;
348
+ private _sanitizeLikeResult;
349
+ private _sanitizeRegisterResult;
350
+ }
351
+
352
+ export { type AEConfig, type AIHandlerOptions, type AITool, type AIToolCall, type AIToolCallResult, type AIToolParameterProperty, type AIToolParameters, type Credential, CredentialManager, FreeFireAIToolHandler, FreeFireAPI, type GarenaClientConfig, type GarenaGuestRegisterResponse, type GarenaTokenResponse, type HeadersConfig, type ItemDetails, LikeAPI, type LikeResult, type MajorLoginResponse, type PlayerBasicInfo, type PlayerClanInfo, type PlayerPetInfo, type PlayerProfile, type PlayerProfileInfo, type PlayerStats, type ProcessedPlayerItems, type RegisterResult, type SearchResult, type Session, type Settings, type URLSConfig, encrypt, freefireTools, getErrorMessage, getItemDetails, getToolByName, getToolNames, loadItems, processPlayerItems, protoHandler };
@@ -0,0 +1,352 @@
1
+ import protobuf from 'protobufjs';
2
+
3
+ interface Session {
4
+ token: string | null;
5
+ serverUrl: string | null;
6
+ openId: string | null;
7
+ accountId: string | null;
8
+ }
9
+ interface Credential {
10
+ uid: string;
11
+ password: string;
12
+ }
13
+ interface GarenaTokenResponse {
14
+ access_token: string;
15
+ open_id: string;
16
+ }
17
+ interface GarenaGuestRegisterResponse {
18
+ uid: string;
19
+ }
20
+ interface MajorLoginResponse {
21
+ token: string;
22
+ serverUrl: string;
23
+ accountid: string;
24
+ }
25
+ interface SearchResult {
26
+ accountid: string;
27
+ nickname: string;
28
+ level: number;
29
+ }
30
+ interface RegisterResult {
31
+ uid: string;
32
+ password: string;
33
+ passwordHash: string;
34
+ region: string;
35
+ nickname: string;
36
+ }
37
+ interface LikeResult {
38
+ success: boolean;
39
+ successCount: number;
40
+ failedCount: number;
41
+ remainingGuests: number;
42
+ message: string;
43
+ }
44
+ interface AEConfig {
45
+ MAIN_KEY: Buffer;
46
+ MAIN_IV: Buffer;
47
+ }
48
+ interface HeadersConfig {
49
+ COMMON: Record<string, string>;
50
+ GARENA_AUTH: Record<string, string>;
51
+ }
52
+ interface URLSConfig {
53
+ GARENA_TOKEN: string;
54
+ GUEST_REGISTER: string;
55
+ MAJOR_LOGIN: string;
56
+ MAJOR_REGISTER: string;
57
+ SEARCH: (serverUrl: string) => string;
58
+ PERSONAL_SHOW: (serverUrl: string) => string;
59
+ PLAYER_STATS: (serverUrl: string) => string;
60
+ PLAYER_CS_STATS: (serverUrl: string) => string;
61
+ }
62
+ interface GarenaClientConfig {
63
+ CLIENT_ID: string;
64
+ CLIENT_SECRET: string;
65
+ }
66
+ interface Settings {
67
+ AE: AEConfig;
68
+ HEADERS: HeadersConfig;
69
+ URLS: URLSConfig;
70
+ GARENA_CLIENT: GarenaClientConfig;
71
+ }
72
+ interface ItemDetails {
73
+ id: number;
74
+ name: string;
75
+ type: string;
76
+ rarity: string;
77
+ description: string;
78
+ is_unique: boolean;
79
+ image: string;
80
+ image_fallback: string;
81
+ collection_type?: string;
82
+ icon_code?: string;
83
+ }
84
+ interface PlayerBasicInfo {
85
+ accountid: string;
86
+ nickname: string;
87
+ level: number;
88
+ exp: number;
89
+ region: string;
90
+ liked: string;
91
+ signature: string;
92
+ createat: number;
93
+ lastloginat: number;
94
+ weaponskinshows: number[];
95
+ }
96
+ interface PlayerClanInfo {
97
+ clanname: string;
98
+ clanid: string;
99
+ }
100
+ interface PlayerPetInfo {
101
+ id: number;
102
+ name: string;
103
+ level: number;
104
+ skinid: number;
105
+ selectedskillid: number;
106
+ }
107
+ interface PlayerProfileInfo {
108
+ clothes: number[];
109
+ equipedskills: number[];
110
+ }
111
+ interface PlayerProfile {
112
+ basicinfo: PlayerBasicInfo;
113
+ claninfo?: PlayerClanInfo;
114
+ petinfo?: PlayerPetInfo;
115
+ profileinfo: PlayerProfileInfo;
116
+ }
117
+ interface PlayerStats {
118
+ solostats?: Record<string, unknown>;
119
+ duostats?: Record<string, unknown>;
120
+ quadstats?: Record<string, unknown>;
121
+ }
122
+ interface ProcessedPlayerItems {
123
+ basic_info: {
124
+ accountid: string;
125
+ nickname: string;
126
+ level: number;
127
+ region: string;
128
+ liked: string;
129
+ signature: string;
130
+ };
131
+ items: {
132
+ outfit: ItemDetails[];
133
+ skills: {
134
+ equipped: ItemDetails[];
135
+ };
136
+ weapons: {
137
+ shown_skins: ItemDetails[];
138
+ };
139
+ pet: {
140
+ id: ItemDetails;
141
+ name: string;
142
+ level: number;
143
+ skin: ItemDetails;
144
+ selected_skill: ItemDetails;
145
+ } | null;
146
+ };
147
+ }
148
+ declare function getErrorMessage(error: unknown): string;
149
+
150
+ /**
151
+ * Manages a pool of guest credentials for a specific Free Fire region.
152
+ * Tracks usage to prevent reusing the same guest account on the same target.
153
+ */
154
+ declare class CredentialManager {
155
+ region: string;
156
+ private pool;
157
+ private currentIndex;
158
+ private usageData;
159
+ /**
160
+ * @param region - Region code whose credential YAML file will be loaded.
161
+ */
162
+ constructor(region: string);
163
+ private _loadPool;
164
+ isUsedForTarget(targetUid: string, guestUid: string): boolean;
165
+ markUsed(targetUid: string, guestUid: string): void;
166
+ getRandomCredential(): Credential | null;
167
+ getNextCredential(): Credential | null;
168
+ getNextForTarget(targetUid: string): Credential | null;
169
+ getMultipleForTarget(targetUid: string, count: number): Credential[];
170
+ getAvailableCount(targetUid: string): number;
171
+ getPoolSize(): number;
172
+ clearUsage(targetUid?: string): void;
173
+ }
174
+
175
+ /**
176
+ * Main API client for interacting with the Free Fire game servers.
177
+ * Handles authentication, player lookup, stats retrieval, and account registration.
178
+ */
179
+ declare class FreeFireAPI {
180
+ session: Session;
181
+ region: string | null;
182
+ credentialManager: CredentialManager | null;
183
+ private allCredentials;
184
+ /**
185
+ * Creates a new FreeFireAPI instance.
186
+ * @param region - Optional region code (e.g., 'IND', 'BR') to scope credential lookup.
187
+ */
188
+ constructor(region?: string | null);
189
+ /**
190
+ * Switches the active region and initializes a new credential manager.
191
+ * @param region - Region code to switch to.
192
+ */
193
+ setRegion(region: string): void;
194
+ private _loadAllCredentials;
195
+ private _getRandomCredentialFromAll;
196
+ /**
197
+ * Logs in using a random credential from any available region pool.
198
+ * @returns A valid session containing token, server URL, and account details.
199
+ */
200
+ loginWithRandomCredentialFromAll(): Promise<Session>;
201
+ /**
202
+ * Logs in using a random credential from the currently set region pool.
203
+ * Falls back to all-region lookup if no region is configured.
204
+ * @returns A valid session containing token, server URL, and account details.
205
+ */
206
+ loginWithRandomCredential(): Promise<Session>;
207
+ /**
208
+ * Authenticates with a specific UID and password.
209
+ * @param uid - Garena account UID.
210
+ * @param password - Account password.
211
+ * @returns A valid session containing token, server URL, and account details.
212
+ */
213
+ login(uid: string, password: string): Promise<Session>;
214
+ private _getGarenaToken;
215
+ private _majorLogin;
216
+ /**
217
+ * Searches for players by nickname across Free Fire servers.
218
+ * @param keyword - Player nickname to search (minimum 3 characters).
219
+ * @returns Array of matching player results.
220
+ */
221
+ searchAccount(keyword: string): Promise<SearchResult[]>;
222
+ /**
223
+ * Retrieves detailed profile information for a player.
224
+ * @param uid - Target player UID.
225
+ * @returns Structured player profile including basic info, clan, and pet data.
226
+ */
227
+ getPlayerProfile(uid: number | string): Promise<PlayerProfile>;
228
+ private _requestProfile;
229
+ /**
230
+ * Fetches and processes a player's equipped items (outfit, weapons, skills, pet).
231
+ * @param uid - Target player UID.
232
+ * @returns Normalized item details mapped from the internal items database.
233
+ */
234
+ getPlayerItems(uid: number | string): Promise<ProcessedPlayerItems | null>;
235
+ /**
236
+ * Retrieves match statistics for a player.
237
+ * @param uid - Target player UID.
238
+ * @param mode - Game mode: 'br' (Battle Royale) or 'cs' (Clash Squad).
239
+ * @param matchType - Match type: 'career', 'ranked', or 'normal'.
240
+ * @returns Structured stats object for solo, duo, and squad matches.
241
+ */
242
+ getPlayerStats(uid: number | string, mode?: 'br' | 'cs', matchType?: 'career' | 'ranked' | 'normal'): Promise<PlayerStats>;
243
+ private _checkSession;
244
+ /**
245
+ * Registers a new guest account in the specified region.
246
+ * @param region - Target region code (e.g., 'IND').
247
+ * @param nickname - Optional nickname; a random one is generated if omitted.
248
+ * @returns Registration result containing UID, password, and region.
249
+ */
250
+ register(region: string, nickname?: string | null): Promise<RegisterResult>;
251
+ private _generateRandomPassword;
252
+ private _guestRegister;
253
+ private _getGarenaTokenForRegister;
254
+ private _xorEncryptOpenId;
255
+ private _encodeVarint;
256
+ private _encodeField;
257
+ private _manualProtobufEncode;
258
+ private _majorRegister;
259
+ private _manualProtobufDecode;
260
+ }
261
+
262
+ /**
263
+ * API client for sending profile likes to a target Free Fire player.
264
+ * Manages guest credential pools per region and rotates through them.
265
+ */
266
+ declare class LikeAPI {
267
+ private credentialManagers;
268
+ private _getCredentialManager;
269
+ private _getBaseUrl;
270
+ private _login;
271
+ private _createLikePayload;
272
+ private _sendLikeWithGuest;
273
+ /**
274
+ * Sends likes to a target player using available guest accounts.
275
+ * @param targetUid - UID of the player to receive likes.
276
+ * @param region - Region code (e.g., 'IND', 'BR').
277
+ * @param likeCount - Number of likes to send (default 100, max 100 per day).
278
+ * @returns Summary of the like operation including success and failure counts.
279
+ */
280
+ sendLikes(targetUid: string, region: string, likeCount?: number): Promise<LikeResult>;
281
+ }
282
+
283
+ declare class ProtoHandler {
284
+ private roots;
285
+ load(filename: string): Promise<protobuf.Root>;
286
+ encode(filename: string, messageName: string, payload: Record<string, unknown>, shouldEncrypt?: boolean): Promise<Buffer>;
287
+ decode(filename: string, messageName: string, buffer: Buffer | ArrayBuffer): Promise<unknown>;
288
+ }
289
+ declare const protoHandler: ProtoHandler;
290
+
291
+ declare function encrypt(buffer: Buffer): Buffer;
292
+
293
+ declare function loadItems(): Record<string, Record<string, unknown>>;
294
+ declare function getItemDetails(itemId: number): ItemDetails;
295
+ declare function processPlayerItems(playerData: PlayerProfile): ProcessedPlayerItems;
296
+
297
+ interface AIToolParameterProperty {
298
+ type: string;
299
+ description: string;
300
+ enum?: string[];
301
+ minimum?: number;
302
+ maximum?: number;
303
+ minLength?: number;
304
+ }
305
+ interface AIToolParameters {
306
+ type: 'object';
307
+ properties: Record<string, AIToolParameterProperty>;
308
+ required: string[];
309
+ }
310
+ interface AITool {
311
+ type: 'function';
312
+ function: {
313
+ name: string;
314
+ description: string;
315
+ parameters: AIToolParameters;
316
+ };
317
+ }
318
+ declare const freefireTools: AITool[];
319
+ declare function getToolByName(name: string): AITool | undefined;
320
+ declare function getToolNames(): string[];
321
+
322
+ interface AIToolCall {
323
+ id: string;
324
+ type: 'function';
325
+ function: {
326
+ name: string;
327
+ arguments: string;
328
+ };
329
+ }
330
+ interface AIToolCallResult {
331
+ tool_call_id: string;
332
+ role: 'tool';
333
+ name: string;
334
+ content: string;
335
+ }
336
+ interface AIHandlerOptions {
337
+ region?: string;
338
+ }
339
+ declare class FreeFireAIToolHandler {
340
+ private api;
341
+ private likeApi;
342
+ constructor(options?: AIHandlerOptions);
343
+ execute(toolCall: AIToolCall): Promise<AIToolCallResult>;
344
+ executeMany(toolCalls: AIToolCall[]): Promise<AIToolCallResult[]>;
345
+ private _dispatch;
346
+ private _buildResult;
347
+ private _sanitizeProfile;
348
+ private _sanitizeLikeResult;
349
+ private _sanitizeRegisterResult;
350
+ }
351
+
352
+ export { type AEConfig, type AIHandlerOptions, type AITool, type AIToolCall, type AIToolCallResult, type AIToolParameterProperty, type AIToolParameters, type Credential, CredentialManager, FreeFireAIToolHandler, FreeFireAPI, type GarenaClientConfig, type GarenaGuestRegisterResponse, type GarenaTokenResponse, type HeadersConfig, type ItemDetails, LikeAPI, type LikeResult, type MajorLoginResponse, type PlayerBasicInfo, type PlayerClanInfo, type PlayerPetInfo, type PlayerProfile, type PlayerProfileInfo, type PlayerStats, type ProcessedPlayerItems, type RegisterResult, type SearchResult, type Session, type Settings, type URLSConfig, encrypt, freefireTools, getErrorMessage, getItemDetails, getToolByName, getToolNames, loadItems, processPlayerItems, protoHandler };
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC5E,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC5E,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AACzD,YAAY,EAAE,MAAM,EAAE,gBAAgB,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AACxF,YAAY,EAAE,UAAU,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACvF,cAAc,SAAS,CAAC"}