gemini-reverse 1.0.2 → 1.0.3

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.
package/constants.js CHANGED
@@ -1,7 +1,22 @@
1
1
  'use strict';
2
2
 
3
+ const STREAMING_FLAG_INDEX = 7;
4
+ const GEM_FLAG_INDEX = 19;
3
5
  const TEMPORARY_CHAT_FLAG_INDEX = 45;
4
6
 
7
+ const CARD_CONTENT_RE = /^http:\/\/googleusercontent\.com\/card_content\/\d+/;
8
+ const ARTIFACTS_RE = /http:\/\/googleusercontent\.com\/\w+\/\d+\n*/g;
9
+ const DEFAULT_METADATA = ['', '', '', null, null, null, null, null, null, ''];
10
+ const MODEL_HEADER_KEY = 'x-goog-ext-525001261-jspb';
11
+
12
+ function buildModelHeader(modelId, capacityTail) {
13
+ return {
14
+ [MODEL_HEADER_KEY]: `[1,null,null,null,"${modelId}",null,null,0,[4],null,null,${capacityTail}]`,
15
+ 'x-goog-ext-73010989-jspb': '[0]',
16
+ 'x-goog-ext-73010990-jspb': '[0]',
17
+ };
18
+ }
19
+
5
20
  const Endpoint = {
6
21
  GOOGLE: 'https://www.google.com',
7
22
  INIT: 'https://gemini.google.com/app',
@@ -14,73 +29,164 @@ const Endpoint = {
14
29
  const GRPC = {
15
30
  LIST_CHATS: 'MaZiqc',
16
31
  READ_CHAT: 'hNvQHb',
17
- DELETE_CHAT: 'GzXR5e',
32
+ DELETE_CHAT_1: 'GzXR5e',
33
+ DELETE_CHAT_2: 'qWymEb',
18
34
  LIST_GEMS: 'CNgdBe',
19
35
  CREATE_GEM: 'oMH3Zd',
20
36
  UPDATE_GEM: 'kHv0Vd',
21
37
  DELETE_GEM: 'UXcSJb',
22
- BARD_ACTIVITY: 'ESY5D',
38
+ DEEP_RESEARCH_STATUS: 'kwDCne',
39
+ DEEP_RESEARCH_PREFS: 'L5adhe',
40
+ DEEP_RESEARCH_BOOTSTRAP: 'ku4Jyf',
41
+ DEEP_RESEARCH_MODEL_STATE: 'qpEbW',
42
+ DEEP_RESEARCH_CAPS: 'aPya6c',
43
+ DEEP_RESEARCH_ACK: 'PCck7e',
44
+ GET_USER_STATUS: 'otAQ7b',
45
+ LIST_MODELS: 'otAQ7b',
46
+ GET_FULL_SIZE_IMAGE: 'c8o8Fe',
47
+ BARD_SETTINGS: 'ESY5D',
23
48
  };
24
49
 
25
50
  const Headers = {
51
+ REFERER: {
52
+ 'Origin': 'https://gemini.google.com',
53
+ 'Referer': 'https://gemini.google.com/',
54
+ },
55
+ SAME_DOMAIN: {
56
+ 'X-Same-Domain': '1',
57
+ },
26
58
  GEMINI: {
27
59
  'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8',
28
- 'Host': 'gemini.google.com',
29
60
  'Origin': 'https://gemini.google.com',
30
61
  'Referer': 'https://gemini.google.com/',
31
- 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/144.0.0.0 Safari/537.36',
32
- 'X-Same-Domain': '1',
33
62
  },
34
63
  ROTATE_COOKIES: {
35
64
  'Content-Type': 'application/json',
65
+ 'Origin': 'https://accounts.google.com',
36
66
  },
37
- UPLOAD: {
38
- 'Push-ID': 'feeds/mcudyrk2a4khkz',
67
+ UPLOAD: { 'X-Tenant-Id': 'bard-storage' },
68
+ BATCH_EXEC: {
69
+ 'x-goog-ext-525001261-jspb': '[1,null,null,null,null,null,null,null,[4]]',
70
+ 'x-goog-ext-73010989-jspb': '[0]',
39
71
  },
40
72
  };
41
73
 
74
+ const _MODEL_KEYS = [
75
+ 'UNSPECIFIED', 'BASIC_PRO', 'BASIC_FLASH', 'BASIC_THINKING',
76
+ 'PLUS_PRO', 'PLUS_FLASH', 'PLUS_THINKING',
77
+ 'ADVANCED_PRO', 'ADVANCED_FLASH', 'ADVANCED_THINKING',
78
+ ];
79
+
42
80
  const Model = {
43
81
  UNSPECIFIED: { model_name: 'unspecified', model_header: {}, advanced_only: false },
44
- G_3_1_PRO: {
45
- model_name: 'gemini-3.1-pro',
46
- model_header: {
47
- 'x-goog-ext-525001261-jspb': '[1,null,null,null,"e6fa609c3fa255c0",null,null,0,[4],null,null,2]',
48
- 'x-goog-ext-73010989-jspb': '[0]',
49
- 'x-goog-ext-73010990-jspb': '[0]',
50
- },
82
+ BASIC_PRO: {
83
+ model_name: 'gemini-3-pro',
84
+ model_header: buildModelHeader('9d8ca3786ebdfbea', 1),
51
85
  advanced_only: false,
52
86
  },
53
- G_3_0_FLASH: {
54
- model_name: 'gemini-3.0-flash',
55
- model_header: {
56
- 'x-goog-ext-525001261-jspb': '[1,null,null,null,"fbb127bbb056c959",null,null,0,[4],null,null,1]',
57
- 'x-goog-ext-73010989-jspb': '[0]',
58
- 'x-goog-ext-73010990-jspb': '[0]',
59
- },
87
+ BASIC_FLASH: {
88
+ model_name: 'gemini-3-flash',
89
+ model_header: buildModelHeader('fbb127bbb056c959', 1),
60
90
  advanced_only: false,
61
91
  },
62
- G_3_0_FLASH_THINKING: {
63
- model_name: 'gemini-3.0-flash-thinking',
64
- model_header: {
65
- 'x-goog-ext-525001261-jspb': '[1,null,null,null,"5bf011840784117a",null,null,0,[4],null,null,1]',
66
- 'x-goog-ext-73010989-jspb': '[0]',
67
- 'x-goog-ext-73010990-jspb': '[0]',
68
- },
92
+ BASIC_THINKING: {
93
+ model_name: 'gemini-3-flash-thinking',
94
+ model_header: buildModelHeader('5bf011840784117a', 1),
69
95
  advanced_only: false,
70
96
  },
97
+ PLUS_PRO: {
98
+ model_name: 'gemini-3-pro-plus',
99
+ model_header: buildModelHeader('e6fa609c3fa255c0', 4),
100
+ advanced_only: true,
101
+ },
102
+ PLUS_FLASH: {
103
+ model_name: 'gemini-3-flash-plus',
104
+ model_header: buildModelHeader('56fdd199312815e2', 4),
105
+ advanced_only: true,
106
+ },
107
+ PLUS_THINKING: {
108
+ model_name: 'gemini-3-flash-thinking-plus',
109
+ model_header: buildModelHeader('e051ce1aa80aa576', 4),
110
+ advanced_only: true,
111
+ },
112
+ ADVANCED_PRO: {
113
+ model_name: 'gemini-3-pro-advanced',
114
+ model_header: buildModelHeader('e6fa609c3fa255c0', 2),
115
+ advanced_only: true,
116
+ },
117
+ ADVANCED_FLASH: {
118
+ model_name: 'gemini-3-flash-advanced',
119
+ model_header: buildModelHeader('56fdd199312815e2', 2),
120
+ advanced_only: true,
121
+ },
122
+ ADVANCED_THINKING: {
123
+ model_name: 'gemini-3-flash-thinking-advanced',
124
+ model_header: buildModelHeader('e051ce1aa80aa576', 2),
125
+ advanced_only: true,
126
+ },
71
127
  fromName(name) {
72
- const legacy = { 'gemini-3.0-pro': 'gemini-3.1-pro' };
73
- const resolved = legacy[name] || name;
74
- for (const k of ['UNSPECIFIED', 'G_3_1_PRO', 'G_3_0_FLASH', 'G_3_0_FLASH_THINKING']) {
75
- if (Model[k].model_name === resolved) return Model[k];
128
+ for (const k of _MODEL_KEYS) {
129
+ if (Model[k].model_name === name) return Model[k];
76
130
  }
77
- throw new Error(`Unknown model name: ${name}. Available: ${['UNSPECIFIED', 'G_3_1_PRO', 'G_3_0_FLASH', 'G_3_0_FLASH_THINKING'].map(k => Model[k].model_name).join(', ')}`);
131
+ const names = _MODEL_KEYS.map(k => Model[k].model_name).join(', ');
132
+ throw new Error(`Unknown model name: ${name}. Available: ${names}`);
78
133
  },
79
134
  fromDict(d) {
80
- if (!d.model_name || !d.model_header || typeof d.model_header !== 'object')
81
- throw new Error('model_name and model_header (object) required');
135
+ if (!d.model_name || !d.model_header || typeof d.model_header !== 'object') {
136
+ throw new Error("model_name and model_header (object) required");
137
+ }
82
138
  return { model_name: d.model_name, model_header: d.model_header, advanced_only: false };
83
139
  },
140
+ modelId(model) {
141
+ const headerValue = model && model.model_header && model.model_header[MODEL_HEADER_KEY];
142
+ if (!headerValue) return '';
143
+ try {
144
+ const parsed = JSON.parse(headerValue);
145
+ return (parsed && parsed[4]) || '';
146
+ } catch {
147
+ return '';
148
+ }
149
+ },
150
+ };
151
+
152
+ class AccountStatus {
153
+ constructor(name, value, description) {
154
+ this.name = name;
155
+ this.value = value;
156
+ this.description = description;
157
+ }
158
+
159
+ static fromStatusCode(code) {
160
+ if (code == null || code === 1000) return AccountStatus.AVAILABLE;
161
+ for (const status of Object.values(AccountStatus._all)) {
162
+ if (status.value === code) return status;
163
+ }
164
+ return AccountStatus.ACCOUNT_REJECTED;
165
+ }
166
+ }
167
+
168
+ AccountStatus.AVAILABLE = new AccountStatus('AVAILABLE', 1000, 'Account is authorized and has normal access.');
169
+ AccountStatus.ACCESS_TEMPORARILY_UNAVAILABLE = new AccountStatus('ACCESS_TEMPORARILY_UNAVAILABLE', 1014, 'Access is restricted, possibly due to regional or temporary session issues.');
170
+ AccountStatus.UNAUTHENTICATED = new AccountStatus('UNAUTHENTICATED', 1016, 'Session is not authenticated or cookies have expired. Please check your cookies.');
171
+ AccountStatus.ACCOUNT_REJECTED = new AccountStatus('ACCOUNT_REJECTED', 1021, 'Account access is rejected. Please check your Google Account settings.');
172
+ AccountStatus.ACCOUNT_UNTRUSTED = new AccountStatus('ACCOUNT_UNTRUSTED', 1033, 'Account did not pass safety or trust checks for some features.');
173
+ AccountStatus.TOS_PENDING = new AccountStatus('TOS_PENDING', 1040, 'You need to accept the latest Terms of Service to continue.');
174
+ AccountStatus.TOS_OUT_OF_DATE = new AccountStatus('TOS_OUT_OF_DATE', 1042, 'Terms of Service are out of date; please accept the new ones.');
175
+ AccountStatus.ACCOUNT_REJECTED_BY_GUARDIAN = new AccountStatus('ACCOUNT_REJECTED_BY_GUARDIAN', 1054, 'Access is blocked by a parent or guardian.');
176
+ AccountStatus.GUARDIAN_APPROVAL_REQUIRED = new AccountStatus('GUARDIAN_APPROVAL_REQUIRED', 1057, 'Access requires parent or guardian approval.');
177
+ AccountStatus.LOCATION_REJECTED = new AccountStatus('LOCATION_REJECTED', 1060, 'Gemini is not currently supported in your country/region.');
178
+
179
+ AccountStatus._all = {
180
+ AVAILABLE: AccountStatus.AVAILABLE,
181
+ ACCESS_TEMPORARILY_UNAVAILABLE: AccountStatus.ACCESS_TEMPORARILY_UNAVAILABLE,
182
+ UNAUTHENTICATED: AccountStatus.UNAUTHENTICATED,
183
+ ACCOUNT_REJECTED: AccountStatus.ACCOUNT_REJECTED,
184
+ ACCOUNT_UNTRUSTED: AccountStatus.ACCOUNT_UNTRUSTED,
185
+ TOS_PENDING: AccountStatus.TOS_PENDING,
186
+ TOS_OUT_OF_DATE: AccountStatus.TOS_OUT_OF_DATE,
187
+ ACCOUNT_REJECTED_BY_GUARDIAN: AccountStatus.ACCOUNT_REJECTED_BY_GUARDIAN,
188
+ GUARDIAN_APPROVAL_REQUIRED: AccountStatus.GUARDIAN_APPROVAL_REQUIRED,
189
+ LOCATION_REJECTED: AccountStatus.LOCATION_REJECTED,
84
190
  };
85
191
 
86
192
  const ErrorCode = {
@@ -91,4 +197,19 @@ const ErrorCode = {
91
197
  IP_TEMPORARILY_BLOCKED: 1060,
92
198
  };
93
199
 
94
- module.exports = { TEMPORARY_CHAT_FLAG_INDEX, Endpoint, GRPC, Headers, Model, ErrorCode };
200
+ module.exports = {
201
+ STREAMING_FLAG_INDEX,
202
+ GEM_FLAG_INDEX,
203
+ TEMPORARY_CHAT_FLAG_INDEX,
204
+ CARD_CONTENT_RE,
205
+ ARTIFACTS_RE,
206
+ DEFAULT_METADATA,
207
+ MODEL_HEADER_KEY,
208
+ buildModelHeader,
209
+ Endpoint,
210
+ GRPC,
211
+ Headers,
212
+ Model,
213
+ AccountStatus,
214
+ ErrorCode,
215
+ };
package/index.d.ts CHANGED
@@ -16,26 +16,71 @@ export interface ModelDict {
16
16
  model_header: ModelHeader;
17
17
  }
18
18
 
19
- export type ModelInput = string | ModelDef | ModelDict | null;
19
+ export type ModelInput = string | ModelDef | ModelDict | AvailableModel | null;
20
+
21
+ export declare function buildModelHeader(modelId: string, capacityTail: string | number): ModelHeader;
22
+
23
+ export declare const MODEL_HEADER_KEY: string;
24
+ export declare const STREAMING_FLAG_INDEX: number;
25
+ export declare const GEM_FLAG_INDEX: number;
26
+ export declare const TEMPORARY_CHAT_FLAG_INDEX: number;
27
+ export declare const CARD_CONTENT_RE: RegExp;
28
+ export declare const ARTIFACTS_RE: RegExp;
29
+ export declare const DEFAULT_METADATA: (string | null)[];
20
30
 
21
31
  export declare const Model: {
22
32
  readonly UNSPECIFIED: ModelDef;
23
- readonly G_3_1_PRO: ModelDef;
24
- readonly G_3_0_FLASH: ModelDef;
25
- readonly G_3_0_FLASH_THINKING: ModelDef;
33
+ readonly BASIC_PRO: ModelDef;
34
+ readonly BASIC_FLASH: ModelDef;
35
+ readonly BASIC_THINKING: ModelDef;
36
+ readonly PLUS_PRO: ModelDef;
37
+ readonly PLUS_FLASH: ModelDef;
38
+ readonly PLUS_THINKING: ModelDef;
39
+ readonly ADVANCED_PRO: ModelDef;
40
+ readonly ADVANCED_FLASH: ModelDef;
41
+ readonly ADVANCED_THINKING: ModelDef;
26
42
  fromName(name: string): ModelDef;
27
43
  fromDict(d: ModelDict): ModelDef;
44
+ modelId(model: ModelDef): string;
28
45
  };
29
46
 
47
+ export declare class AccountStatus {
48
+ readonly name: string;
49
+ readonly value: number;
50
+ readonly description: string;
51
+ constructor(name: string, value: number, description: string);
52
+ static fromStatusCode(code: number | null | undefined): AccountStatus;
53
+ static readonly AVAILABLE: AccountStatus;
54
+ static readonly ACCESS_TEMPORARILY_UNAVAILABLE: AccountStatus;
55
+ static readonly UNAUTHENTICATED: AccountStatus;
56
+ static readonly ACCOUNT_REJECTED: AccountStatus;
57
+ static readonly ACCOUNT_UNTRUSTED: AccountStatus;
58
+ static readonly TOS_PENDING: AccountStatus;
59
+ static readonly TOS_OUT_OF_DATE: AccountStatus;
60
+ static readonly ACCOUNT_REJECTED_BY_GUARDIAN: AccountStatus;
61
+ static readonly GUARDIAN_APPROVAL_REQUIRED: AccountStatus;
62
+ static readonly LOCATION_REJECTED: AccountStatus;
63
+ }
64
+
30
65
  export declare const GRPC: {
31
66
  readonly LIST_CHATS: string;
32
67
  readonly READ_CHAT: string;
33
- readonly DELETE_CHAT: string;
68
+ readonly DELETE_CHAT_1: string;
69
+ readonly DELETE_CHAT_2: string;
34
70
  readonly LIST_GEMS: string;
35
71
  readonly CREATE_GEM: string;
36
72
  readonly UPDATE_GEM: string;
37
73
  readonly DELETE_GEM: string;
38
- readonly BARD_ACTIVITY: string;
74
+ readonly DEEP_RESEARCH_STATUS: string;
75
+ readonly DEEP_RESEARCH_PREFS: string;
76
+ readonly DEEP_RESEARCH_BOOTSTRAP: string;
77
+ readonly DEEP_RESEARCH_MODEL_STATE: string;
78
+ readonly DEEP_RESEARCH_CAPS: string;
79
+ readonly DEEP_RESEARCH_ACK: string;
80
+ readonly GET_USER_STATUS: string;
81
+ readonly LIST_MODELS: string;
82
+ readonly GET_FULL_SIZE_IMAGE: string;
83
+ readonly BARD_SETTINGS: string;
39
84
  };
40
85
 
41
86
  export declare const Endpoint: {
@@ -48,9 +93,12 @@ export declare const Endpoint: {
48
93
  };
49
94
 
50
95
  export declare const Headers: {
96
+ readonly REFERER: Record<string, string>;
97
+ readonly SAME_DOMAIN: Record<string, string>;
51
98
  readonly GEMINI: Record<string, string>;
52
99
  readonly ROTATE_COOKIES: Record<string, string>;
53
100
  readonly UPLOAD: Record<string, string>;
101
+ readonly BATCH_EXEC: Record<string, string>;
54
102
  };
55
103
 
56
104
  export declare const ErrorCode: {
@@ -61,8 +109,6 @@ export declare const ErrorCode: {
61
109
  readonly IP_TEMPORARILY_BLOCKED: 1060;
62
110
  };
63
111
 
64
- export declare const TEMPORARY_CHAT_FLAG_INDEX: number;
65
-
66
112
  export declare class AuthError extends Error { name: 'AuthError'; }
67
113
  export declare class APIError extends Error { name: 'APIError'; }
68
114
  export declare class ImageGenerationError extends APIError { name: 'ImageGenerationError'; }
@@ -72,12 +118,35 @@ export declare class UsageLimitExceeded extends GeminiError { name: 'UsageLimitE
72
118
  export declare class ModelInvalid extends GeminiError { name: 'ModelInvalid'; }
73
119
  export declare class TemporarilyBlocked extends GeminiError { name: 'TemporarilyBlocked'; }
74
120
 
121
+ export declare class AvailableModel {
122
+ model_id: string;
123
+ model_name: string;
124
+ display_name: string;
125
+ description: string;
126
+ capacity: number;
127
+ capacity_field: number;
128
+ is_available: boolean;
129
+ constructor(opts: {
130
+ model_id: string;
131
+ model_name: string;
132
+ display_name: string;
133
+ description: string;
134
+ capacity: number;
135
+ capacity_field?: number;
136
+ is_available?: boolean;
137
+ });
138
+ get model_header(): ModelHeader;
139
+ get advanced_only(): boolean;
140
+ toString(): string;
141
+ repr(): string;
142
+ static computeCapacity(tierFlags: number[], capabilityFlags: number[]): [number, number];
143
+ static buildModelIdNameMapping(): Record<string, string>;
144
+ }
145
+
75
146
  export interface ImageSaveOptions {
76
147
  path?: string;
77
148
  filename?: string;
78
- cookies?: Record<string, string> | null;
79
149
  verbose?: boolean;
80
- skipInvalidFilename?: boolean;
81
150
  }
82
151
 
83
152
  export declare class Image {
@@ -92,14 +161,120 @@ export declare class Image {
92
161
 
93
162
  export declare class WebImage extends Image {}
94
163
 
95
- export interface GeneratedImageSaveOptions extends ImageSaveOptions {
96
- fullSize?: boolean;
164
+ export declare class GeneratedImage extends Image {
165
+ client_ref: GeminiClient | null;
166
+ cid: string;
167
+ rid: string;
168
+ rcid: string;
169
+ image_id: string;
170
+ constructor(opts: {
171
+ url: string;
172
+ title?: string;
173
+ alt?: string;
174
+ proxy?: string | null;
175
+ client_ref?: GeminiClient | null;
176
+ cid?: string;
177
+ rid?: string;
178
+ rcid?: string;
179
+ image_id?: string;
180
+ });
97
181
  }
98
182
 
99
- export declare class GeneratedImage extends Image {
100
- cookies: Record<string, string>;
101
- constructor(opts: { url: string; title?: string; alt?: string; proxy?: string | null; cookies: Record<string, string> });
102
- save(opts?: GeneratedImageSaveOptions): Promise<string | null>;
183
+ export interface VideoSaveOptions {
184
+ savePath?: string;
185
+ filename?: string;
186
+ verbose?: boolean;
187
+ }
188
+
189
+ export declare class Video {
190
+ url: string;
191
+ title: string;
192
+ proxy: string | null;
193
+ constructor(opts: { url: string; title?: string; proxy?: string | null });
194
+ save(opts?: VideoSaveOptions): Promise<{ video: string | null; video_thumbnail: string | null }>;
195
+ repr(): string;
196
+ }
197
+
198
+ export declare class GeneratedVideo extends Video {
199
+ thumbnail: string;
200
+ cid: string;
201
+ rid: string;
202
+ rcid: string;
203
+ client_ref: GeminiClient | null;
204
+ constructor(opts: {
205
+ url: string;
206
+ title?: string;
207
+ proxy?: string | null;
208
+ thumbnail?: string;
209
+ cid?: string;
210
+ rid?: string;
211
+ rcid?: string;
212
+ client_ref?: GeminiClient | null;
213
+ });
214
+ }
215
+
216
+ export declare class GeneratedMedia extends GeneratedVideo {
217
+ mp3_url: string;
218
+ mp3_thumbnail: string;
219
+ get mp4_url(): string;
220
+ set mp4_url(v: string);
221
+ get mp4_thumbnail(): string;
222
+ set mp4_thumbnail(v: string);
223
+ constructor(opts: {
224
+ url?: string;
225
+ title?: string;
226
+ proxy?: string | null;
227
+ thumbnail?: string;
228
+ mp3_url?: string;
229
+ mp3_thumbnail?: string;
230
+ cid?: string;
231
+ rid?: string;
232
+ rcid?: string;
233
+ client_ref?: GeminiClient | null;
234
+ });
235
+ save(opts?: VideoSaveOptions & { downloadType?: 'audio' | 'video' | 'both' }): Promise<Record<string, string | null>>;
236
+ }
237
+
238
+ export declare class DeepResearchPlan {
239
+ research_id: string | null;
240
+ title: string | null;
241
+ query: string | null;
242
+ steps: string[];
243
+ eta_text: string | null;
244
+ confirm_prompt: string | null;
245
+ modify_prompt: string | null;
246
+ confirmation_url: string | null;
247
+ metadata: (string | null)[];
248
+ cid: string | null;
249
+ response_text: string | null;
250
+ raw_state: number | null;
251
+ constructor(opts?: Partial<DeepResearchPlan>);
252
+ repr(): string;
253
+ }
254
+
255
+ export declare class DeepResearchStatus {
256
+ research_id: string;
257
+ state: string;
258
+ title: string | null;
259
+ query: string | null;
260
+ cid: string | null;
261
+ notes: string[];
262
+ done: boolean;
263
+ raw_state: number | null;
264
+ raw: unknown;
265
+ constructor(opts: { research_id: string; state?: string; title?: string | null; query?: string | null; cid?: string | null; notes?: string[]; done?: boolean; raw_state?: number | null; raw?: unknown });
266
+ repr(): string;
267
+ }
268
+
269
+ export declare class DeepResearchResult {
270
+ plan: DeepResearchPlan;
271
+ start_output: ModelOutput | null;
272
+ final_output: ModelOutput | null;
273
+ statuses: DeepResearchStatus[];
274
+ done: boolean;
275
+ constructor(opts: { plan: DeepResearchPlan; start_output?: ModelOutput | null; final_output?: ModelOutput | null; statuses?: DeepResearchStatus[]; done?: boolean });
276
+ get text(): string;
277
+ repr(): string;
103
278
  }
104
279
 
105
280
  export declare class Candidate {
@@ -110,6 +285,9 @@ export declare class Candidate {
110
285
  thoughts_delta: string | null;
111
286
  web_images: WebImage[];
112
287
  generated_images: GeneratedImage[];
288
+ generated_videos: GeneratedVideo[];
289
+ generated_media: GeneratedMedia[];
290
+ deep_research_plan: DeepResearchPlan | null;
113
291
  constructor(opts: {
114
292
  rcid: string;
115
293
  text: string;
@@ -118,6 +296,9 @@ export declare class Candidate {
118
296
  thoughts_delta?: string | null;
119
297
  web_images?: WebImage[];
120
298
  generated_images?: GeneratedImage[];
299
+ generated_videos?: GeneratedVideo[];
300
+ generated_media?: GeneratedMedia[];
301
+ deep_research_plan?: DeepResearchPlan | null;
121
302
  });
122
303
  get images(): (WebImage | GeneratedImage)[];
123
304
  toString(): string;
@@ -125,35 +306,46 @@ export declare class Candidate {
125
306
  }
126
307
 
127
308
  export declare class ModelOutput {
128
- metadata: string[];
309
+ metadata: (string | null)[];
129
310
  candidates: Candidate[];
130
311
  chosen: number;
131
- constructor(metadata: string[], candidates: Candidate[], chosen?: number);
312
+ constructor(metadata: (string | null)[], candidates: Candidate[], chosen?: number);
132
313
  get text(): string;
133
314
  get text_delta(): string;
134
315
  get thoughts(): string | null;
135
316
  get thoughts_delta(): string;
136
317
  get images(): (WebImage | GeneratedImage)[];
318
+ get videos(): GeneratedVideo[];
319
+ get media(): GeneratedMedia[];
320
+ get deep_research_plan(): DeepResearchPlan | null;
137
321
  get rcid(): string;
138
322
  toString(): string;
139
323
  repr(): string;
140
324
  }
141
325
 
142
- export declare class ConversationTurn {
143
- rid: string;
144
- user_prompt: string;
145
- assistant_response: string;
146
- rcid: string;
147
- thoughts: string | null;
148
- timestamp: Date | null;
149
- constructor(opts: {
150
- rid: string;
151
- user_prompt: string;
152
- assistant_response: string;
153
- rcid: string;
154
- thoughts?: string | null;
155
- timestamp?: Date | string | null;
156
- });
326
+ export declare class ChatTurn {
327
+ role: 'user' | 'model';
328
+ text: string;
329
+ model_output: ModelOutput | null;
330
+ constructor(opts: { role: 'user' | 'model'; text: string; model_output?: ModelOutput | null });
331
+ toString(): string;
332
+ repr(): string;
333
+ }
334
+
335
+ export declare class ChatHistory {
336
+ cid: string;
337
+ turns: ChatTurn[];
338
+ constructor(opts: { cid: string; turns?: ChatTurn[] });
339
+ toString(): string;
340
+ repr(): string;
341
+ }
342
+
343
+ export declare class ChatInfo {
344
+ cid: string;
345
+ title: string;
346
+ is_pinned: boolean;
347
+ timestamp: number;
348
+ constructor(opts: { cid: string; title: string; is_pinned?: boolean; timestamp: number });
157
349
  toString(): string;
158
350
  repr(): string;
159
351
  }
@@ -224,13 +416,14 @@ export interface GenerateOptions {
224
416
  gem?: Gem | string | null;
225
417
  chat?: ChatSession | null;
226
418
  temporary?: boolean;
419
+ deep_research?: boolean;
227
420
  }
228
421
 
229
422
  export interface StartChatOptions {
230
- metadata?: string[] | null;
231
- cid?: string | null;
232
- rid?: string | null;
233
- rcid?: string | null;
423
+ metadata?: (string | null)[] | null;
424
+ cid?: string;
425
+ rid?: string;
426
+ rcid?: string;
234
427
  model?: ModelInput;
235
428
  gem?: Gem | string | null;
236
429
  }
@@ -259,6 +452,9 @@ export declare class GeminiClient {
259
452
  accessToken: string | null;
260
453
  buildLabel: string | null;
261
454
  sessionId: string | null;
455
+ language: string;
456
+ pushId: string;
457
+ accountStatus: AccountStatus;
262
458
  timeout: number;
263
459
  autoClose: boolean;
264
460
  closeDelay: number;
@@ -272,13 +468,16 @@ export declare class GeminiClient {
272
468
  init(opts?: InitOptions): Promise<void>;
273
469
  close(delay?: number): Promise<void>;
274
470
 
471
+ listModels(): AvailableModel[] | null;
472
+
275
473
  generateContent(opts: GenerateOptions): Promise<ModelOutput>;
276
474
  generateContentStream(opts: GenerateOptions): AsyncGenerator<ModelOutput>;
277
475
 
278
476
  startChat(opts?: StartChatOptions): ChatSession;
279
477
 
478
+ listChats(): ChatInfo[] | null;
479
+ readChat(cid: string, limit?: number): Promise<ChatHistory | null>;
280
480
  fetchLatestChatResponse(cid: string): Promise<ModelOutput | null>;
281
- readChat(cid: string, maxTurns?: number): Promise<ConversationTurn[]>;
282
481
  deleteChat(cid: string): Promise<void>;
283
482
 
284
483
  get gems(): GemJar;
@@ -286,14 +485,21 @@ export declare class GeminiClient {
286
485
  createGem(opts: CreateGemOptions): Promise<Gem>;
287
486
  updateGem(opts: UpdateGemOptions): Promise<Gem>;
288
487
  deleteGem(gem: Gem | string): Promise<void>;
488
+
489
+ inspectAccountStatus(): Promise<Record<string, unknown>>;
490
+ createDeepResearchPlan(prompt: string, chat?: ChatSession | null, model?: ModelInput): Promise<DeepResearchPlan>;
491
+ startDeepResearch(plan: DeepResearchPlan, chat?: ChatSession | null, confirmPrompt?: string | null): Promise<ModelOutput>;
492
+ getDeepResearchStatus(researchId: string): Promise<DeepResearchStatus | null>;
493
+ waitForDeepResearch(plan: DeepResearchPlan, pollInterval?: number, timeout?: number, onStatus?: ((status: DeepResearchStatus) => void) | null): Promise<DeepResearchResult>;
494
+ deepResearch(prompt: string, pollInterval?: number, timeout?: number, onStatus?: ((status: DeepResearchStatus) => void) | null): Promise<DeepResearchResult>;
289
495
  }
290
496
 
291
497
  export interface ChatSessionOptions {
292
498
  geminiclient: GeminiClient;
293
- metadata?: string[] | null;
294
- cid?: string | null;
295
- rid?: string | null;
296
- rcid?: string | null;
499
+ metadata?: (string | null)[] | null;
500
+ cid?: string;
501
+ rid?: string;
502
+ rcid?: string;
297
503
  model?: ModelInput;
298
504
  gem?: Gem | string | null;
299
505
  }
@@ -302,18 +508,19 @@ export interface SendMessageOptions {
302
508
  prompt: string;
303
509
  files?: (string | Buffer)[] | null;
304
510
  temporary?: boolean;
511
+ deep_research?: boolean;
305
512
  }
306
513
 
307
514
  export declare class ChatSession {
308
515
  geminiclient: GeminiClient;
309
516
  lastOutput: ModelOutput | null;
310
- model: ModelDef;
517
+ model: ModelDef | AvailableModel;
311
518
  gem: Gem | string | null;
312
519
 
313
520
  constructor(opts: ChatSessionOptions);
314
521
 
315
- get metadata(): string[];
316
- set metadata(v: string[]);
522
+ get metadata(): (string | null)[];
523
+ set metadata(v: (string | null)[]);
317
524
  get cid(): string;
318
525
  set cid(v: string);
319
526
  get rid(): string;
@@ -324,6 +531,7 @@ export declare class ChatSession {
324
531
  sendMessage(opts: SendMessageOptions): Promise<ModelOutput>;
325
532
  sendMessageStream(opts: SendMessageOptions): AsyncGenerator<ModelOutput>;
326
533
  chooseCandidate(index: number): ModelOutput;
534
+ readHistory(limit?: number): Promise<ChatHistory | null>;
327
535
 
328
536
  toString(): string;
329
- }
537
+ }