@tryhamster/gerbil 1.0.0-rc.0 → 1.0.0-rc.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 (94) hide show
  1. package/README.md +79 -14
  2. package/dist/auto-update-DsWBBnEk.mjs +3 -0
  3. package/dist/browser/index.d.mts +401 -5
  4. package/dist/browser/index.d.mts.map +1 -1
  5. package/dist/browser/index.mjs +1772 -146
  6. package/dist/browser/index.mjs.map +1 -1
  7. package/dist/{chrome-backend-CtwPENIW.mjs → chrome-backend-JEPeM2YE.mjs} +1 -1
  8. package/dist/{chrome-backend-C5Un08O4.mjs → chrome-backend-Y9F7W5VQ.mjs} +514 -73
  9. package/dist/chrome-backend-Y9F7W5VQ.mjs.map +1 -0
  10. package/dist/cli.mjs +3359 -646
  11. package/dist/cli.mjs.map +1 -1
  12. package/dist/frameworks/express.d.mts +1 -1
  13. package/dist/frameworks/express.mjs +3 -3
  14. package/dist/frameworks/fastify.d.mts +1 -1
  15. package/dist/frameworks/fastify.mjs +3 -3
  16. package/dist/frameworks/hono.d.mts +1 -1
  17. package/dist/frameworks/hono.mjs +3 -3
  18. package/dist/frameworks/next.d.mts +2 -2
  19. package/dist/frameworks/next.mjs +3 -3
  20. package/dist/frameworks/react.d.mts +1 -1
  21. package/dist/frameworks/trpc.d.mts +1 -1
  22. package/dist/frameworks/trpc.mjs +3 -3
  23. package/dist/gerbil-DeQlX_Mt.mjs +5 -0
  24. package/dist/gerbil-POAz8peb.d.mts +431 -0
  25. package/dist/gerbil-POAz8peb.d.mts.map +1 -0
  26. package/dist/gerbil-yoSpRHgv.mjs +1463 -0
  27. package/dist/gerbil-yoSpRHgv.mjs.map +1 -0
  28. package/dist/index.d.mts +395 -9
  29. package/dist/index.d.mts.map +1 -1
  30. package/dist/index.mjs +8 -6
  31. package/dist/index.mjs.map +1 -1
  32. package/dist/integrations/ai-sdk.d.mts +122 -4
  33. package/dist/integrations/ai-sdk.d.mts.map +1 -1
  34. package/dist/integrations/ai-sdk.mjs +239 -11
  35. package/dist/integrations/ai-sdk.mjs.map +1 -1
  36. package/dist/integrations/langchain.d.mts +132 -2
  37. package/dist/integrations/langchain.d.mts.map +1 -1
  38. package/dist/integrations/langchain.mjs +176 -8
  39. package/dist/integrations/langchain.mjs.map +1 -1
  40. package/dist/integrations/llamaindex.d.mts +1 -1
  41. package/dist/integrations/llamaindex.mjs +3 -3
  42. package/dist/integrations/mcp-client.mjs +4 -4
  43. package/dist/integrations/mcp-client.mjs.map +1 -1
  44. package/dist/integrations/mcp.d.mts +2 -2
  45. package/dist/integrations/mcp.d.mts.map +1 -1
  46. package/dist/integrations/mcp.mjs +6 -6
  47. package/dist/{mcp-R8kRLIKb.mjs → mcp-Bitg4sjX.mjs} +10 -37
  48. package/dist/mcp-Bitg4sjX.mjs.map +1 -0
  49. package/dist/microphone-D-6y9aiE.mjs +3 -0
  50. package/dist/{models-DKULvhOr.mjs → models-BAtL8qsA.mjs} +42 -7
  51. package/dist/models-BAtL8qsA.mjs.map +1 -0
  52. package/dist/{models-De2-_GmQ.d.mts → models-CE0fBq0U.d.mts} +2 -2
  53. package/dist/models-CE0fBq0U.d.mts.map +1 -0
  54. package/dist/{one-liner-BUQR0nqq.mjs → one-liner-B1rmFto6.mjs} +2 -2
  55. package/dist/{one-liner-BUQR0nqq.mjs.map → one-liner-B1rmFto6.mjs.map} +1 -1
  56. package/dist/repl-D20JO260.mjs +10 -0
  57. package/dist/skills/index.d.mts +303 -12
  58. package/dist/skills/index.d.mts.map +1 -1
  59. package/dist/skills/index.mjs +6 -6
  60. package/dist/skills-5DxAV-rn.mjs +1435 -0
  61. package/dist/skills-5DxAV-rn.mjs.map +1 -0
  62. package/dist/stt-Bv_dum-R.mjs +433 -0
  63. package/dist/stt-Bv_dum-R.mjs.map +1 -0
  64. package/dist/stt-KzSoNvwI.mjs +3 -0
  65. package/dist/{tools-BsiEE6f2.mjs → tools-IYPrqoek.mjs} +6 -7
  66. package/dist/{tools-BsiEE6f2.mjs.map → tools-IYPrqoek.mjs.map} +1 -1
  67. package/dist/tts-5yWeP_I0.mjs +3 -0
  68. package/dist/tts-DG6denWG.mjs +729 -0
  69. package/dist/tts-DG6denWG.mjs.map +1 -0
  70. package/dist/types-s6Py2_DL.d.mts +353 -0
  71. package/dist/types-s6Py2_DL.d.mts.map +1 -0
  72. package/dist/{utils-7vXqtq2Q.mjs → utils-CkB4Roi6.mjs} +1 -1
  73. package/dist/{utils-7vXqtq2Q.mjs.map → utils-CkB4Roi6.mjs.map} +1 -1
  74. package/docs/ai-sdk.md +137 -21
  75. package/docs/browser.md +241 -2
  76. package/docs/memory.md +72 -0
  77. package/docs/stt.md +494 -0
  78. package/docs/tts.md +569 -0
  79. package/docs/vision.md +396 -0
  80. package/package.json +17 -18
  81. package/dist/auto-update-BbNHbSU1.mjs +0 -3
  82. package/dist/chrome-backend-C5Un08O4.mjs.map +0 -1
  83. package/dist/gerbil-BfnsFWRE.mjs +0 -644
  84. package/dist/gerbil-BfnsFWRE.mjs.map +0 -1
  85. package/dist/gerbil-BjW-z7Fq.mjs +0 -5
  86. package/dist/gerbil-DZ1k3ChC.d.mts +0 -138
  87. package/dist/gerbil-DZ1k3ChC.d.mts.map +0 -1
  88. package/dist/mcp-R8kRLIKb.mjs.map +0 -1
  89. package/dist/models-DKULvhOr.mjs.map +0 -1
  90. package/dist/models-De2-_GmQ.d.mts.map +0 -1
  91. package/dist/skills-D3CEpgDc.mjs +0 -630
  92. package/dist/skills-D3CEpgDc.mjs.map +0 -1
  93. package/dist/types-BS1N92Jt.d.mts +0 -183
  94. package/dist/types-BS1N92Jt.d.mts.map +0 -1
@@ -1,4 +1,4 @@
1
- import { s as GerbilConfig } from "../types-BS1N92Jt.mjs";
1
+ import { c as GerbilConfig } from "../types-s6Py2_DL.mjs";
2
2
  import { Request, Response, Router } from "express";
3
3
 
4
4
  //#region src/frameworks/express.d.ts
@@ -1,7 +1,7 @@
1
1
  import { t as __require } from "../chunk-Ct1HF2bE.mjs";
2
- import "../models-DKULvhOr.mjs";
3
- import "../utils-7vXqtq2Q.mjs";
4
- import { t as Gerbil } from "../gerbil-BfnsFWRE.mjs";
2
+ import { t as Gerbil } from "../gerbil-yoSpRHgv.mjs";
3
+ import "../models-BAtL8qsA.mjs";
4
+ import "../utils-CkB4Roi6.mjs";
5
5
 
6
6
  //#region src/frameworks/express.ts
7
7
  /**
@@ -1,4 +1,4 @@
1
- import { s as GerbilConfig } from "../types-BS1N92Jt.mjs";
1
+ import { c as GerbilConfig } from "../types-s6Py2_DL.mjs";
2
2
 
3
3
  //#region src/frameworks/fastify.d.ts
4
4
 
@@ -1,6 +1,6 @@
1
- import "../models-DKULvhOr.mjs";
2
- import "../utils-7vXqtq2Q.mjs";
3
- import { t as Gerbil } from "../gerbil-BfnsFWRE.mjs";
1
+ import { t as Gerbil } from "../gerbil-yoSpRHgv.mjs";
2
+ import "../models-BAtL8qsA.mjs";
3
+ import "../utils-CkB4Roi6.mjs";
4
4
 
5
5
  //#region src/frameworks/fastify.ts
6
6
  /**
@@ -1,4 +1,4 @@
1
- import { s as GerbilConfig } from "../types-BS1N92Jt.mjs";
1
+ import { c as GerbilConfig } from "../types-s6Py2_DL.mjs";
2
2
  import * as hono0 from "hono";
3
3
  import * as hono_types0 from "hono/types";
4
4
 
@@ -1,6 +1,6 @@
1
- import "../models-DKULvhOr.mjs";
2
- import "../utils-7vXqtq2Q.mjs";
3
- import { t as Gerbil } from "../gerbil-BfnsFWRE.mjs";
1
+ import { t as Gerbil } from "../gerbil-yoSpRHgv.mjs";
2
+ import "../models-BAtL8qsA.mjs";
3
+ import "../utils-CkB4Roi6.mjs";
4
4
 
5
5
  //#region src/frameworks/hono.ts
6
6
  /**
@@ -1,5 +1,5 @@
1
- import { s as GerbilConfig } from "../types-BS1N92Jt.mjs";
2
- import { t as Gerbil } from "../gerbil-DZ1k3ChC.mjs";
1
+ import { c as GerbilConfig } from "../types-s6Py2_DL.mjs";
2
+ import { t as Gerbil } from "../gerbil-POAz8peb.mjs";
3
3
 
4
4
  //#region src/frameworks/next.d.ts
5
5
 
@@ -1,6 +1,6 @@
1
- import "../models-DKULvhOr.mjs";
2
- import "../utils-7vXqtq2Q.mjs";
3
- import { t as Gerbil } from "../gerbil-BfnsFWRE.mjs";
1
+ import { t as Gerbil } from "../gerbil-yoSpRHgv.mjs";
2
+ import "../models-BAtL8qsA.mjs";
3
+ import "../utils-CkB4Roi6.mjs";
4
4
 
5
5
  //#region src/frameworks/next.ts
6
6
  /**
@@ -1,4 +1,4 @@
1
- import { a as GenerateOptions, o as GenerateResult, s as GerbilConfig } from "../types-BS1N92Jt.mjs";
1
+ import { c as GerbilConfig, o as GenerateOptions, s as GenerateResult } from "../types-s6Py2_DL.mjs";
2
2
 
3
3
  //#region src/frameworks/react.d.ts
4
4
 
@@ -1,4 +1,4 @@
1
- import { s as GerbilConfig } from "../types-BS1N92Jt.mjs";
1
+ import { c as GerbilConfig } from "../types-s6Py2_DL.mjs";
2
2
 
3
3
  //#region src/frameworks/trpc.d.ts
4
4
 
@@ -1,6 +1,6 @@
1
- import "../models-DKULvhOr.mjs";
2
- import "../utils-7vXqtq2Q.mjs";
3
- import { t as Gerbil } from "../gerbil-BfnsFWRE.mjs";
1
+ import { t as Gerbil } from "../gerbil-yoSpRHgv.mjs";
2
+ import "../models-BAtL8qsA.mjs";
3
+ import "../utils-CkB4Roi6.mjs";
4
4
  import { z } from "zod";
5
5
 
6
6
  //#region src/frameworks/trpc.ts
@@ -0,0 +1,5 @@
1
+ import { t as Gerbil } from "./gerbil-yoSpRHgv.mjs";
2
+ import "./models-BAtL8qsA.mjs";
3
+ import "./utils-CkB4Roi6.mjs";
4
+
5
+ export { Gerbil };
@@ -0,0 +1,431 @@
1
+ import { C as SpeakResult, E as SystemInfo, O as TranscribeOptions, S as SpeakOptions, T as StreamingTranscriptionSession, b as STTModelConfig, c as GerbilConfig, f as JsonOptions, g as ModelConfig, h as LoadTTSOptions, i as EmbedResult, j as VoiceInfo, k as TranscribeResult, m as LoadSTTOptions, o as GenerateOptions, p as LoadOptions, r as EmbedOptions, s as GenerateResult, t as AudioChunk, w as StreamingTranscriptionOptions, x as SessionStats } from "./types-s6Py2_DL.mjs";
2
+
3
+ //#region src/core/gerbil.d.ts
4
+
5
+ declare class Gerbil {
6
+ private generator;
7
+ private tokenizer;
8
+ private model;
9
+ private embedder;
10
+ private currentModel;
11
+ private modelConfig;
12
+ private readonly config;
13
+ private stats;
14
+ private useDirect;
15
+ private chromeBackend;
16
+ private _deviceMode;
17
+ private processor;
18
+ private visionModel;
19
+ private isVisionModel;
20
+ constructor(config?: GerbilConfig);
21
+ static listModels(): ModelConfig[];
22
+ static getModel(modelId: string): ModelConfig | undefined;
23
+ /**
24
+ * Load a model
25
+ *
26
+ * @example
27
+ * ```ts
28
+ * // Built-in model
29
+ * await g.loadModel("qwen3-0.6b");
30
+ *
31
+ * // HuggingFace model
32
+ * await g.loadModel("hf:microsoft/Phi-3-mini");
33
+ *
34
+ * // Local model
35
+ * await g.loadModel("file:./models/my-model");
36
+ *
37
+ * // Vision model
38
+ * await g.loadModel("ministral-3b");
39
+ * ```
40
+ */
41
+ loadModel(modelId?: string, options?: LoadOptions): Promise<void>;
42
+ /**
43
+ * Load a vision model (VLM)
44
+ * Uses AutoProcessor + AutoModelForImageTextToText instead of tokenizer + causal LM
45
+ */
46
+ private loadVisionModel;
47
+ /**
48
+ * Check if a model is loaded
49
+ */
50
+ isLoaded(): boolean;
51
+ /**
52
+ * Check if current model supports vision
53
+ */
54
+ supportsVision(): boolean;
55
+ /**
56
+ * Get current model info
57
+ */
58
+ getModelInfo(): ModelConfig | null;
59
+ /**
60
+ * Get current device mode (webgpu, cpu, or wasm)
61
+ */
62
+ getDeviceMode(): "webgpu" | "cpu" | "wasm";
63
+ /**
64
+ * Get dtype used for current model
65
+ */
66
+ getDtype(): string;
67
+ /**
68
+ * Get response cache statistics
69
+ */
70
+ getResponseCacheStats(): {
71
+ hits: number;
72
+ misses: number;
73
+ size: number;
74
+ hitRate: number;
75
+ };
76
+ /**
77
+ * Clear the response cache (for cached generate() results)
78
+ */
79
+ clearResponseCache(): void;
80
+ /**
81
+ * Get Chrome backend status (if using WebGPU via Chrome)
82
+ */
83
+ getChromeStatus(): {
84
+ pid: number | null;
85
+ port: number;
86
+ modelId: string;
87
+ startedAt: Date | null;
88
+ } | null;
89
+ /**
90
+ * Get Chrome memory usage (if using WebGPU via Chrome)
91
+ * Returns JS heap memory in bytes
92
+ */
93
+ getChromeMemory(): Promise<{
94
+ jsHeapUsed: number;
95
+ jsHeapTotal: number;
96
+ } | null>;
97
+ /**
98
+ * Get memory usage in GB (if using WebGPU via Chrome)
99
+ */
100
+ getMemoryUsage(): Promise<{
101
+ usedGB: number;
102
+ totalGB: number;
103
+ usedPercent: number;
104
+ } | null>;
105
+ /**
106
+ * Clear KV cache to free memory
107
+ * This will reset the conversation context but free up memory
108
+ */
109
+ clearCache(): Promise<void>;
110
+ /**
111
+ * Check memory usage and cleanup if needed
112
+ * @param thresholdGB Memory threshold in GB (default: 8)
113
+ * @returns true if cleanup was performed
114
+ */
115
+ checkMemoryAndCleanup(thresholdGB?: number): Promise<boolean>;
116
+ /**
117
+ * Generate text (automatically routes to vision generation if images provided)
118
+ *
119
+ * @example
120
+ * ```ts
121
+ * // Text generation
122
+ * const result = await g.generate("Hello!");
123
+ *
124
+ * // Vision generation (with vision model)
125
+ * const result = await g.generate("What's in this image?", {
126
+ * images: [{ source: "https://example.com/cat.jpg" }]
127
+ * });
128
+ * ```
129
+ */
130
+ generate(prompt: string, options?: GenerateOptions): Promise<GenerateResult>;
131
+ /**
132
+ * Stream text generation (simulated token-by-token)
133
+ *
134
+ * Note: Yields the raw output including <think> tags if thinking mode is enabled.
135
+ * The final result has parsed thinking separated out.
136
+ */
137
+ stream(prompt: string, options?: GenerateOptions): AsyncGenerator<string, GenerateResult, unknown>;
138
+ /**
139
+ * Internal: Generate with raw text access for streaming
140
+ */
141
+ private generateRaw;
142
+ /**
143
+ * Generate text from images using a vision model
144
+ * Called automatically by generate() when images are provided
145
+ */
146
+ private generateWithVision;
147
+ /**
148
+ * Generate structured JSON output
149
+ */
150
+ json<T>(prompt: string, options: JsonOptions<T>): Promise<T>;
151
+ /**
152
+ * Generate embeddings
153
+ */
154
+ embed(text: string, options?: EmbedOptions): Promise<EmbedResult>;
155
+ /**
156
+ * Generate embeddings for multiple texts
157
+ */
158
+ embedBatch(texts: string[], options?: EmbedOptions): Promise<EmbedResult[]>;
159
+ /**
160
+ * Get session stats
161
+ */
162
+ getStats(): SessionStats;
163
+ /**
164
+ * Get system info
165
+ */
166
+ getInfo(): SystemInfo;
167
+ /**
168
+ * Reset stats
169
+ */
170
+ resetStats(): void;
171
+ private tts;
172
+ private ttsModelId;
173
+ /**
174
+ * Load TTS model for text-to-speech synthesis
175
+ *
176
+ * @example
177
+ * ```ts
178
+ * // Load default (Kokoro)
179
+ * await g.loadTTS({ onProgress: (p) => console.log(p.status) });
180
+ *
181
+ * // Load Supertonic (faster, 44kHz output)
182
+ * await g.loadTTS({ model: "supertonic-66m" });
183
+ *
184
+ * const result = await g.speak("Hello world");
185
+ * // result.audio = Float32Array, result.sampleRate = 24000 or 44100
186
+ * ```
187
+ */
188
+ loadTTS(options?: LoadTTSOptions & {
189
+ model?: string;
190
+ }): Promise<void>;
191
+ /**
192
+ * Ensure TTS model is loaded (lazy loading)
193
+ */
194
+ ensureTTSLoaded(options?: LoadTTSOptions): Promise<void>;
195
+ /**
196
+ * Generate speech from text
197
+ *
198
+ * @example
199
+ * ```ts
200
+ * const result = await g.speak("Hello world", { voice: "af_bella" });
201
+ * // result.audio = Float32Array PCM
202
+ * // result.sampleRate = 24000
203
+ * // result.duration = seconds
204
+ * ```
205
+ */
206
+ speak(text: string, options?: SpeakOptions): Promise<SpeakResult>;
207
+ /**
208
+ * Stream speech generation (yields audio chunks as they're generated)
209
+ *
210
+ * @example
211
+ * ```ts
212
+ * for await (const chunk of g.speakStream("Long text...")) {
213
+ * // chunk.samples = Float32Array
214
+ * // chunk.isFinal = boolean
215
+ * playChunk(chunk);
216
+ * }
217
+ * ```
218
+ */
219
+ speakStream(text: string, options?: SpeakOptions): AsyncGenerator<AudioChunk, SpeakResult, unknown>;
220
+ /**
221
+ * Get list of available TTS voices
222
+ */
223
+ listVoices(): VoiceInfo[];
224
+ /**
225
+ * Check if TTS model is loaded
226
+ */
227
+ isTTSLoaded(): boolean;
228
+ /**
229
+ * Get current TTS model info
230
+ */
231
+ getTTSModelInfo(): {
232
+ id: string;
233
+ loaded: boolean;
234
+ device?: "webgpu" | "cpu";
235
+ } | null;
236
+ /**
237
+ * List available TTS models
238
+ */
239
+ listTTSModels(): Promise<Array<{
240
+ id: string;
241
+ description: string;
242
+ sampleRate: number;
243
+ voiceCount: number;
244
+ }>>;
245
+ private stt;
246
+ /**
247
+ * Load STT model for speech-to-text transcription
248
+ *
249
+ * @example
250
+ * ```ts
251
+ * await g.loadSTT({
252
+ * onProgress: (p) => console.log(p.status)
253
+ * });
254
+ *
255
+ * const result = await g.transcribe(audioData);
256
+ * console.log(result.text);
257
+ * ```
258
+ */
259
+ loadSTT(modelId?: string, options?: LoadSTTOptions): Promise<void>;
260
+ /**
261
+ * Ensure STT model is loaded (lazy loading)
262
+ */
263
+ ensureSTTLoaded(modelId?: string, options?: LoadSTTOptions): Promise<void>;
264
+ /**
265
+ * Transcribe audio to text
266
+ *
267
+ * @param audio - Audio data as Float32Array (16kHz mono) or Uint8Array (WAV file)
268
+ * @param options - Transcription options
269
+ *
270
+ * @example
271
+ * ```ts
272
+ * // From Float32Array (16kHz mono)
273
+ * const result = await g.transcribe(audioData);
274
+ * console.log(result.text);
275
+ *
276
+ * // With timestamps
277
+ * const result = await g.transcribe(audioData, { timestamps: true });
278
+ * for (const seg of result.segments) {
279
+ * console.log(`[${seg.start}s] ${seg.text}`);
280
+ * }
281
+ *
282
+ * // From WAV file
283
+ * const wavData = fs.readFileSync("audio.wav");
284
+ * const result = await g.transcribe(new Uint8Array(wavData));
285
+ * ```
286
+ */
287
+ transcribe(audio: Float32Array | Uint8Array, options?: TranscribeOptions): Promise<TranscribeResult>;
288
+ /**
289
+ * Create a streaming transcription session
290
+ *
291
+ * Transcribes audio in real-time by processing chunks at regular intervals.
292
+ * Perfect for live captioning, call transcription, or real-time subtitles.
293
+ *
294
+ * @param options - Streaming options
295
+ * @returns Streaming session controller
296
+ *
297
+ * @example
298
+ * ```ts
299
+ * const session = await g.createStreamingTranscription({
300
+ * chunkDuration: 3000, // Transcribe every 3 seconds
301
+ * onChunk: (text, idx) => console.log(`Chunk ${idx}: ${text}`),
302
+ * onTranscript: (fullText) => console.log("Full:", fullText),
303
+ * });
304
+ *
305
+ * // Feed audio data as it comes in
306
+ * session.feedAudio(audioChunk);
307
+ *
308
+ * // Start automatic interval-based transcription
309
+ * session.start();
310
+ *
311
+ * // Later, stop and get final transcript
312
+ * const finalText = await session.stop();
313
+ * ```
314
+ */
315
+ createStreamingTranscription(options?: StreamingTranscriptionOptions): Promise<StreamingTranscriptionSession>;
316
+ /**
317
+ * Get list of available STT models
318
+ */
319
+ listSTTModels(): Promise<STTModelConfig[]>;
320
+ /**
321
+ * Check if STT model is loaded
322
+ */
323
+ isSTTLoaded(): boolean;
324
+ /**
325
+ * Get current STT model info
326
+ */
327
+ getSTTModelInfo(): {
328
+ id: string;
329
+ loaded: boolean;
330
+ device?: "webgpu" | "cpu";
331
+ } | null;
332
+ /**
333
+ * Record audio from microphone and transcribe
334
+ *
335
+ * @example
336
+ * ```ts
337
+ * // Record for 5 seconds and transcribe
338
+ * const result = await g.listen(5000);
339
+ * console.log(result.text);
340
+ *
341
+ * // Use with voice chat
342
+ * const userInput = await g.listen(10000);
343
+ * const response = await g.generate(userInput.text);
344
+ * await g.speak(response.text);
345
+ * ```
346
+ */
347
+ listen(durationMs?: number, options?: {
348
+ onProgress?: (status: string) => void;
349
+ }): Promise<TranscribeResult>;
350
+ /**
351
+ * Check if microphone recording is available
352
+ */
353
+ isMicrophoneAvailable(): Promise<boolean>;
354
+ /**
355
+ * Dispose of resources
356
+ * @param disconnect If true, also disconnect from shared browser (for clean script exit)
357
+ */
358
+ dispose(disconnect?: boolean): Promise<void>;
359
+ /**
360
+ * Shutdown the shared Chrome backend completely.
361
+ * Call this when your script/process is done to ensure proper cleanup.
362
+ * This closes the shared browser used for WebGPU acceleration.
363
+ */
364
+ static shutdown(): Promise<void>;
365
+ /**
366
+ * Get global WebGPU process info (all active backends)
367
+ * Useful for monitoring and debugging memory leaks
368
+ */
369
+ static getWebGPUProcesses(): Promise<{
370
+ browser: {
371
+ running: boolean;
372
+ pid: number | null;
373
+ port: number;
374
+ activePagesCount: number;
375
+ maxPages: number;
376
+ };
377
+ backends: Array<{
378
+ modelId: string;
379
+ isVision: boolean;
380
+ isReady: boolean;
381
+ memory: {
382
+ usedGB: number;
383
+ totalGB: number;
384
+ usedPercent: number;
385
+ } | null;
386
+ }>;
387
+ } | null>;
388
+ /**
389
+ * Kill all WebGPU processes (for zombie cleanup)
390
+ * Use this if you suspect memory leaks from undisposed Gerbil instances
391
+ */
392
+ static killAllWebGPU(): Promise<{
393
+ pagesKilled: number;
394
+ browserKilled: boolean;
395
+ } | null>;
396
+ /**
397
+ * Kill a specific WebGPU backend by index
398
+ * @param index Index of the backend to kill (0-based)
399
+ */
400
+ static killWebGPUBackend(index: number): Promise<boolean>;
401
+ /**
402
+ * Get all Chrome pages across ALL Gerbil processes
403
+ * This provides cross-process visibility into WebGPU backends
404
+ */
405
+ static getAllChromePagesInfo(): Promise<Array<{
406
+ url: string;
407
+ title: string;
408
+ isOurs: boolean;
409
+ modelId: string | null;
410
+ memory: {
411
+ usedGB: number;
412
+ totalGB: number;
413
+ } | null;
414
+ }> | null>;
415
+ /**
416
+ * Kill a Chrome page by index (works across processes)
417
+ * @param index Index of the page to kill (0-based)
418
+ */
419
+ static killChromePage(index: number): Promise<boolean>;
420
+ /**
421
+ * Get total Chrome page count (all processes)
422
+ */
423
+ static getTotalChromePageCount(): Promise<number>;
424
+ private formatPrompt;
425
+ private buildMessages;
426
+ private parseThinking;
427
+ private cleanOutput;
428
+ }
429
+ //#endregion
430
+ export { Gerbil as t };
431
+ //# sourceMappingURL=gerbil-POAz8peb.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gerbil-POAz8peb.d.mts","names":[],"sources":["../src/core/gerbil.ts"],"sourcesContent":[],"mappings":";;;;AAqOsB,cAlBT,MAAA,CAkBS;EAiBC,QAAA,SAAA;EAIa,QAAA,SAAA;EA0Be,QAAA,KAAA;EAAmB,QAAA,QAAA;EA8SpD,QAAA,YAAA;EA+CH,QAAA,WAAA;EAYY,iBAAA,MAAA;EAUD,QAAA,KAAA;EAWJ,QAAA,SAAA;EAW0B,QAAA,aAAA;EAyBN,QAAA,WAAA;EAA+B,QAAA,SAAA;EAAR,QAAA,WAAA;EAsNpD,QAAA,aAAA;EACe,WAAA,CAAA,MAAA,CAAA,EAxqBN,YAwqBM;EAAvB,OAAA,UAAA,CAAA,CAAA,EAvpBkB,WAupBlB,EAAA;EA0SgD,OAAA,QAAA,CAAA,OAAA,EAAA,MAAA,CAAA,EA77BjB,WA67BiB,GAAA,SAAA;EAAZ;;;;;;;;;;;;;;;;;;EAgN5B,SAAA,CAAA,OAAA,CAAA,EAAA,MAAA,EAAA,OAAA,CAAA,EAnnCsC,WAmnCtC,CAAA,EAnnCyD,OAmnCzD,CAAA,IAAA,CAAA;EACO;;;;EAyChB,QAAA,eAAA;EADqB;;;EAiDkC,QAAA,CAAA,CAAA,EAAA,OAAA;EAAiB;;;EA+B/D,cAAA,CAAA,CAAA,EAAA,OAAA;EACA;;;EAkCA,YAAA,CAAA,CAAA,EAj+BK,WAi+BL,GAAA,IAAA;EAAR;;;EAyDQ,aAAA,CAAA,CAAA,EAAA,QAAA,GAAA,KAAA,GAAA,MAAA;EAAR;;;EAiIsB,QAAA,CAAA,CAAA,EAAA,MAAA;EAkBb;;;EA6CmC,qBAAA,CAAA,CAAA,EAAA;IAkBD,IAAA,EAAA,MAAA;IAAR,MAAA,EAAA,MAAA;IAuBM,IAAA,EAAA,MAAA;IAgBJ,OAAA,EAAA,MAAA;EAAO,CAAA;;;;;;;;;;;;eApuClC;;;;;;qBAYY;;;;;;;oBAUD;;;;;;;;;gBAWJ;;;;;;+CAW0B;;;;;;;;;;;;;;;qCAyBN,kBAAuB,QAAQ;;;;;;;mCAsN5D,kBACR,uBAAuB;;;;;;;;;;;;;mCA0Sa,YAAY,KAAK,QAAQ;;;;gCAqC7B,eAAoB,QAAQ;;;;wCAyBpB,eAAoB,QAAQ;;;;cAe3D;;;;aAOD;;;;;;;;;;;;;;;;;;;;;;oBA4DY;;MAA2C;;;;4BA4BlC,iBAAiB;;;;;;;;;;;;gCAiBd,eAAoB,QAAQ;;;;;;;;;;;;;sCAmBpD,eACR,eAAe,YAAY;;;;gBAQhB;;;;;;;;;;;;;;;;mBAgCS,QACrB;;;;;;;;;;;;;;;;;;;;sCA8BuC,iBAAsB;;;;8CAkBN,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;oBA8BjE,eAAe,sBACb,oBACR,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;yCAiCA,gCACR,QAAQ;;;;mBAQY,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAiD5B,QAAQ;;;;2BAmCoB;;;;;iCAiBI;;;;;;qBA6EV;;;;;+BAUU;;;;;;;;cAQvB;;;;;;;;;;;;;;;0BA2BkB;;;;;;;;2CAkBiB;;;;;kCAkBT,QAAQ;;;;;;;;;;;;;;wCAuBF;;;;oCAgBJ"}