@tryhamster/gerbil 1.3.1 → 1.4.0
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/dist/architectures-Ol7yUmKf.mjs.map +1 -1
- package/dist/browser/index.d.ts +7 -1
- package/dist/browser/index.d.ts.map +1 -1
- package/dist/cli.mjs +7 -7
- package/dist/cli.mjs.map +1 -1
- package/dist/{defaults-CudhglS1.mjs → defaults-KnrRSIeJ.mjs} +20 -7
- package/dist/defaults-KnrRSIeJ.mjs.map +1 -0
- package/dist/frameworks/express.d.mts +2 -2
- package/dist/frameworks/express.mjs +1 -1
- package/dist/frameworks/fastify.d.mts +2 -2
- package/dist/frameworks/fastify.mjs +1 -1
- package/dist/frameworks/hono.d.mts +2 -2
- package/dist/frameworks/hono.mjs +1 -1
- package/dist/frameworks/next.d.mts +4 -4
- package/dist/frameworks/next.mjs +1 -1
- package/dist/frameworks/react.d.mts +2 -2
- package/dist/frameworks/trpc.d.mts +2 -2
- package/dist/frameworks/trpc.mjs +1 -1
- package/dist/gerbil-CUzVDAU7.mjs +4 -0
- package/dist/{gerbil-Du-1M2Wq.mjs → gerbil-DGrCwGtJ.mjs} +26 -3
- package/dist/{gerbil-Du-1M2Wq.mjs.map → gerbil-DGrCwGtJ.mjs.map} +1 -1
- package/dist/{gerbil-4Xid85_Z.d.mts → gerbil-_68_JSGV.d.mts} +15 -4
- package/dist/gerbil-_68_JSGV.d.mts.map +1 -0
- package/dist/gpu/hooks.d.mts +21 -16
- package/dist/gpu/hooks.d.mts.map +1 -1
- package/dist/gpu/hooks.mjs +20 -15
- package/dist/gpu/hooks.mjs.map +1 -1
- package/dist/gpu/index.d.mts +3 -3
- package/dist/gpu/index.mjs +4 -4
- package/dist/{gpu-BECDib8p.mjs → gpu-DbB321DN.mjs} +1530 -235
- package/dist/gpu-DbB321DN.mjs.map +1 -0
- package/dist/{index-C4kJrqs1.d.mts → index-BdbeBDTz.d.mts} +210 -9
- package/dist/index-BdbeBDTz.d.mts.map +1 -0
- package/dist/index.d.mts +4 -4
- package/dist/index.mjs +5 -5
- package/dist/integrations/ai-sdk.d.mts +2 -2
- package/dist/integrations/ai-sdk.mjs +1 -1
- package/dist/integrations/langchain.d.mts +2 -2
- package/dist/integrations/langchain.mjs +1 -1
- package/dist/integrations/llamaindex.d.mts +2 -2
- package/dist/integrations/llamaindex.mjs +1 -1
- package/dist/integrations/mcp.d.mts +4 -4
- package/dist/integrations/mcp.mjs +4 -4
- package/dist/{mcp-4imtBQLX.mjs → mcp-DcE3wn-L.mjs} +3 -3
- package/dist/{mcp-4imtBQLX.mjs.map → mcp-DcE3wn-L.mjs.map} +1 -1
- package/dist/{moonshine-stt-BO5gZ_D6.mjs → moonshine-stt-BGmctcdO.mjs} +555 -7
- package/dist/moonshine-stt-BGmctcdO.mjs.map +1 -0
- package/dist/moonshine-stt-QoNJeCzR.mjs +4 -0
- package/dist/{one-liner-X5vMbWzs.mjs → one-liner-DTGg6zdm.mjs} +2 -2
- package/dist/{one-liner-X5vMbWzs.mjs.map → one-liner-DTGg6zdm.mjs.map} +1 -1
- package/dist/{outetts-DmR0NfSG.d.mts → outetts-Cr5oGk4z.d.mts} +9 -6
- package/dist/{outetts-DmR0NfSG.d.mts.map → outetts-Cr5oGk4z.d.mts.map} +1 -1
- package/dist/{repl-CGadrKcY.mjs → repl-Ci0zXCT_.mjs} +3 -3
- package/dist/skills/index.d.mts +6 -6
- package/dist/skills/index.mjs +3 -3
- package/dist/{skills-BFGAXYkm.mjs → skills-Dsf0op66.mjs} +2 -2
- package/dist/{skills-BFGAXYkm.mjs.map → skills-Dsf0op66.mjs.map} +1 -1
- package/dist/{types-Cpf-aOxX.d.mts → types-CjG36Vzj.d.mts} +9 -3
- package/dist/{types-Cpf-aOxX.d.mts.map → types-CjG36Vzj.d.mts.map} +1 -1
- package/package.json +1 -1
- package/dist/defaults-CudhglS1.mjs.map +0 -1
- package/dist/gerbil-4Xid85_Z.d.mts.map +0 -1
- package/dist/gerbil-BikD0xFU.mjs +0 -4
- package/dist/gpu-BECDib8p.mjs.map +0 -1
- package/dist/index-C4kJrqs1.d.mts.map +0 -1
- package/dist/moonshine-stt-BO5gZ_D6.mjs.map +0 -1
- package/dist/moonshine-stt-fVw-UB4s.mjs +0 -4
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as DEFAULT_MODEL, t as Gerbil } from "./gerbil-
|
|
1
|
+
import { r as DEFAULT_MODEL, t as Gerbil } from "./gerbil-DGrCwGtJ.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/core/one-liner.ts
|
|
4
4
|
let instance = null;
|
|
@@ -93,4 +93,4 @@ var one_liner_default = gerbil;
|
|
|
93
93
|
|
|
94
94
|
//#endregion
|
|
95
95
|
export { generateObject as a, one_liner_default as c, generate as i, stream as l, embed as n, getInstance as o, embedBatch as r, json as s, dispose as t };
|
|
96
|
-
//# sourceMappingURL=one-liner-
|
|
96
|
+
//# sourceMappingURL=one-liner-DTGg6zdm.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"one-liner-
|
|
1
|
+
{"version":3,"file":"one-liner-DTGg6zdm.mjs","names":["instance: Gerbil | null","loadPromise: Promise<void> | null","currentModel: string | null"],"sources":["../src/core/one-liner.ts"],"sourcesContent":["/**\n * One-liner API for Gerbil\n *\n * @example\n * ```ts\n * import gerbil from \"gerbil\";\n *\n * const text = await gerbil(\"Write a haiku\");\n * ```\n */\n\nimport type { GenerateObjectOptions, GenerateObjectResult } from \"../gpu/index.js\";\nimport { Gerbil } from \"./gerbil.js\";\nimport { DEFAULT_MODEL } from \"./models.js\";\nimport type {\n EmbedOptions,\n EmbedResult,\n GenerateOptions,\n GenerateResult,\n JsonOptions,\n} from \"./types.js\";\n\n// Singleton instance (lazy loaded)\nlet instance: Gerbil | null = null;\nlet loadPromise: Promise<void> | null = null;\nlet currentModel: string | null = null;\n\nasync function getInstance(model?: string): Promise<Gerbil> {\n const requestedModel = model || DEFAULT_MODEL;\n\n // If requesting a different model, we need a new instance\n if (instance && currentModel && currentModel !== requestedModel) {\n // Dispose old instance and create new one with requested model\n await instance.dispose();\n instance = null;\n loadPromise = null;\n currentModel = null;\n }\n\n if (!instance) {\n instance = new Gerbil();\n }\n\n if (!(instance.isLoaded() || loadPromise)) {\n currentModel = requestedModel;\n loadPromise = instance.loadModel(requestedModel);\n }\n\n if (loadPromise) {\n await loadPromise;\n loadPromise = null;\n }\n\n return instance;\n}\n\n// ============================================\n// Main Function\n// ============================================\n\ninterface GerbilOptions extends GenerateOptions {\n model?: string;\n}\n\n/**\n * Generate text with zero setup\n *\n * @example\n * ```ts\n * const text = await gerbil(\"Write a haiku\");\n * const text = await gerbil(\"Explain this\", { model: \"qwen3.5-0.8b\", thinking: true });\n * ```\n */\nasync function gerbil(prompt: string, options: GerbilOptions = {}): Promise<string> {\n const { model, ...generateOptions } = options;\n const g = await getInstance(model);\n const result = await g.generate(prompt, generateOptions);\n return result.text;\n}\n\n// ============================================\n// Functional Exports\n// ============================================\n\n/**\n * Generate text (returns full result)\n */\nexport async function generate(\n prompt: string,\n options: GerbilOptions = {},\n): Promise<GenerateResult> {\n const { model, ...generateOptions } = options;\n const g = await getInstance(model);\n return g.generate(prompt, generateOptions);\n}\n\n/**\n * Stream text generation\n */\nexport async function* stream(\n prompt: string,\n options: GerbilOptions = {},\n): AsyncGenerator<string, GenerateResult, unknown> {\n const { model, ...generateOptions } = options;\n const g = await getInstance(model);\n return yield* g.stream(prompt, generateOptions);\n}\n\n/**\n * Generate structured JSON (Zod-validated)\n */\nexport async function json<T>(\n prompt: string,\n options: JsonOptions<T> & { model?: string },\n): Promise<T> {\n const { model, ...jsonOptions } = options;\n const g = await getInstance(model);\n return g.json(prompt, jsonOptions);\n}\n\n/**\n * Generate a structured object via the engine's retrying generateObject\n * (predicate or `{ required: [...] }` validator). See {@link Gerbil.generateObject}.\n */\nexport async function generateObject<T = unknown>(\n prompt: string,\n options: GenerateObjectOptions & { model?: string } = {},\n): Promise<GenerateObjectResult<T>> {\n const { model, ...objectOptions } = options;\n const g = await getInstance(model);\n return g.generateObject<T>(prompt, objectOptions);\n}\n\n/**\n * Generate embeddings\n */\nexport async function embed(\n text: string,\n options: EmbedOptions & { model?: string } = {},\n): Promise<EmbedResult> {\n const { model, ...embedOptions } = options;\n const g = await getInstance(model);\n return g.embed(text, embedOptions);\n}\n\n/**\n * Generate embeddings for multiple texts\n */\nexport async function embedBatch(\n texts: string[],\n options: EmbedOptions & { model?: string } = {},\n): Promise<EmbedResult[]> {\n const { model, ...embedOptions } = options;\n const g = await getInstance(model);\n return g.embedBatch(texts, embedOptions);\n}\n\n/**\n * Dispose singleton instance\n */\nexport async function dispose(): Promise<void> {\n if (instance) {\n await instance.dispose();\n instance = null;\n loadPromise = null;\n }\n}\n\n/**\n * Get singleton instance (for advanced usage)\n */\nexport { getInstance };\n\nexport default gerbil;\n"],"mappings":";;;AAuBA,IAAIA,WAA0B;AAC9B,IAAIC,cAAoC;AACxC,IAAIC,eAA8B;AAElC,eAAe,YAAY,OAAiC;CAC1D,MAAM,iBAAiB,SAAS;AAGhC,KAAI,YAAY,gBAAgB,iBAAiB,gBAAgB;AAE/D,QAAM,SAAS,SAAS;AACxB,aAAW;AACX,gBAAc;AACd,iBAAe;;AAGjB,KAAI,CAAC,SACH,YAAW,IAAI,QAAQ;AAGzB,KAAI,EAAE,SAAS,UAAU,IAAI,cAAc;AACzC,iBAAe;AACf,gBAAc,SAAS,UAAU,eAAe;;AAGlD,KAAI,aAAa;AACf,QAAM;AACN,gBAAc;;AAGhB,QAAO;;;;;;;;;;;AAoBT,eAAe,OAAO,QAAgB,UAAyB,EAAE,EAAmB;CAClF,MAAM,EAAE,OAAO,GAAG,oBAAoB;AAGtC,SADe,OADL,MAAM,YAAY,MAAM,EACX,SAAS,QAAQ,gBAAgB,EAC1C;;;;;AAUhB,eAAsB,SACpB,QACA,UAAyB,EAAE,EACF;CACzB,MAAM,EAAE,OAAO,GAAG,oBAAoB;AAEtC,SADU,MAAM,YAAY,MAAM,EACzB,SAAS,QAAQ,gBAAgB;;;;;AAM5C,gBAAuB,OACrB,QACA,UAAyB,EAAE,EACsB;CACjD,MAAM,EAAE,OAAO,GAAG,oBAAoB;AAEtC,QAAO,QADG,MAAM,YAAY,MAAM,EAClB,OAAO,QAAQ,gBAAgB;;;;;AAMjD,eAAsB,KACpB,QACA,SACY;CACZ,MAAM,EAAE,OAAO,GAAG,gBAAgB;AAElC,SADU,MAAM,YAAY,MAAM,EACzB,KAAK,QAAQ,YAAY;;;;;;AAOpC,eAAsB,eACpB,QACA,UAAsD,EAAE,EACtB;CAClC,MAAM,EAAE,OAAO,GAAG,kBAAkB;AAEpC,SADU,MAAM,YAAY,MAAM,EACzB,eAAkB,QAAQ,cAAc;;;;;AAMnD,eAAsB,MACpB,MACA,UAA6C,EAAE,EACzB;CACtB,MAAM,EAAE,OAAO,GAAG,iBAAiB;AAEnC,SADU,MAAM,YAAY,MAAM,EACzB,MAAM,MAAM,aAAa;;;;;AAMpC,eAAsB,WACpB,OACA,UAA6C,EAAE,EACvB;CACxB,MAAM,EAAE,OAAO,GAAG,iBAAiB;AAEnC,SADU,MAAM,YAAY,MAAM,EACzB,WAAW,OAAO,aAAa;;;;;AAM1C,eAAsB,UAAyB;AAC7C,KAAI,UAAU;AACZ,QAAM,SAAS,SAAS;AACxB,aAAW;AACX,gBAAc;;;AASlB,wBAAe"}
|
|
@@ -172,11 +172,14 @@ declare class OuteTTS {
|
|
|
172
172
|
* Fidelity vs outetts `create_speaker`: the DAC-encode (audio → c1/c2 codes) and the
|
|
173
173
|
* energy/spectral_centroid/pitch feature math are a faithful port. Two documented
|
|
174
174
|
* approximations: (a) word→frame ALIGNMENT — outetts uses Whisper word timestamps to
|
|
175
|
-
* slice the code stream
|
|
176
|
-
*
|
|
177
|
-
* {@link
|
|
178
|
-
*
|
|
179
|
-
* and
|
|
175
|
+
* slice the code stream. Gerbil's on-device Moonshine STT does not expose word
|
|
176
|
+
* timestamps (its decoder cross-attention is never read back), so we instead run an
|
|
177
|
+
* energy-forced aligner ({@link alignWordsByEnergy}) that snaps word boundaries onto
|
|
178
|
+
* the clip's own silence gaps — audio-driven, tighter than the old char-proportional
|
|
179
|
+
* guess, and exact when each word is pause-separated; it falls back to proportional
|
|
180
|
+
* for continuous speech. (b) we skip outetts' pyloudnorm pre-normalization (it mainly
|
|
181
|
+
* rescales absolute level / the energy bucket). The cloned voice timbre and prosody
|
|
182
|
+
* come through; only the per-word boundaries remain an estimate.
|
|
180
183
|
*/
|
|
181
184
|
encodeSpeaker(ref: OuteSpeaker | {
|
|
182
185
|
audio: Float32Array;
|
|
@@ -216,4 +219,4 @@ declare class OuteTTS {
|
|
|
216
219
|
}
|
|
217
220
|
//#endregion
|
|
218
221
|
export { OuteSpeakerWord as a, buildOutePromptString as c, OuteSpeaker as i, loadOuteSpeaker as l, OuteSpeakOptions as n, OuteTTS as o, OuteSpeakResult as r, OuteTTSOptions as s, OuteDType as t };
|
|
219
|
-
//# sourceMappingURL=outetts-
|
|
222
|
+
//# sourceMappingURL=outetts-Cr5oGk4z.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"outetts-
|
|
1
|
+
{"version":3,"file":"outetts-Cr5oGk4z.d.mts","names":[],"sources":["../src/gpu/outetts.ts"],"sourcesContent":[],"mappings":";;AAkDA;AAOA;AAiHA;AA0BA;AA8BA;AA0BA;AAEA;AA4BA;AAsIA;;;;;;;;;;;;;;;;;;UA9WiB,eAAA;;;;;;;;;;;UAOA,WAAA;;SAER;;;;;;;;;iBA+GO,qBAAA,yBAA8C;;;;;;;iBA0BxC,eAAA,wCAAuD,QAAQ;UA8BpE,cAAA;;;;;;;;;;;;;YAaL;;;;;UAKF;;;;;;;KAQE,SAAA;UAEK,gBAAA;;;;;;;;;;;;;;;;;;;;;;;;;YAyBL;;UAGK,eAAA;;OAEV;;;;;;;;cAoIM,OAAA;;;;;;;;;;kBAWK;;yBA4Ba,iBAAiB,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;6BA0CtB,mBAAwB,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;qBAoDzD;WAAuB;;;MAC3B,QAAQ;;;;;;6CAqFqC,mBAAwB"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import "./gerbil-
|
|
1
|
+
import "./gerbil-DGrCwGtJ.mjs";
|
|
2
2
|
import "./utils-DKO55ZmZ.mjs";
|
|
3
|
-
import "./one-liner-
|
|
3
|
+
import "./one-liner-DTGg6zdm.mjs";
|
|
4
4
|
import "./architectures-Ol7yUmKf.mjs";
|
|
5
|
-
import "./skills-
|
|
5
|
+
import "./skills-Dsf0op66.mjs";
|
|
6
6
|
import "./tools-DQ1mPUw5.mjs";
|
|
7
7
|
import { n as startRepl, t as setCleanupPromise } from "./cli.mjs";
|
|
8
8
|
|
package/dist/skills/index.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import "../outetts-
|
|
2
|
-
import "../types-
|
|
3
|
-
import "../index-
|
|
4
|
-
import { t as Gerbil } from "../gerbil-
|
|
1
|
+
import "../outetts-Cr5oGk4z.mjs";
|
|
2
|
+
import "../types-CjG36Vzj.mjs";
|
|
3
|
+
import "../index-BdbeBDTz.mjs";
|
|
4
|
+
import { t as Gerbil } from "../gerbil-_68_JSGV.mjs";
|
|
5
5
|
import { z } from "zod";
|
|
6
6
|
|
|
7
7
|
//#region src/skills/types.d.ts
|
|
@@ -387,8 +387,8 @@ declare const extract: Skill<{
|
|
|
387
387
|
declare const ExtractFromImageInput: z.ZodObject<{
|
|
388
388
|
image: z.ZodString;
|
|
389
389
|
extract: z.ZodDefault<z.ZodEnum<{
|
|
390
|
-
text: "text";
|
|
391
390
|
code: "code";
|
|
391
|
+
text: "text";
|
|
392
392
|
data: "data";
|
|
393
393
|
table: "table";
|
|
394
394
|
diagram: "diagram";
|
|
@@ -406,7 +406,7 @@ declare const ExtractFromImageInput: z.ZodObject<{
|
|
|
406
406
|
type ExtractFromImageInput = z.infer<typeof ExtractFromImageInput>;
|
|
407
407
|
declare const extractFromImage: Skill<{
|
|
408
408
|
image: string;
|
|
409
|
-
extract: "
|
|
409
|
+
extract: "code" | "text" | "data" | "table" | "diagram" | "form" | "receipt";
|
|
410
410
|
outputFormat: "raw" | "json" | "markdown" | "csv";
|
|
411
411
|
language?: string | undefined;
|
|
412
412
|
}, string>;
|
package/dist/skills/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import "../gerbil-
|
|
1
|
+
import "../gerbil-DGrCwGtJ.mjs";
|
|
2
2
|
import "../utils-DKO55ZmZ.mjs";
|
|
3
|
-
import "../one-liner-
|
|
4
|
-
import { A as useSkill, C as clearSkills, D as hasSkill, E as getSkillInfo, O as listSkills, S as loadSkills, T as getAllSkillInfo, _ as announce, a as summarize, b as loadSkill, c as readAloud, d as extract, f as explain, g as captionImage, h as commit, i as test, k as removeSkill, l as inspectModel, m as compareImages, n as transcribe, o as speak, p as describeImage, r as title, s as review, t as translate, u as extractFromImage, v as analyzeScreenshot, w as defineSkill, x as loadSkillPackage, y as loadProjectSkills } from "../skills-
|
|
3
|
+
import "../one-liner-DTGg6zdm.mjs";
|
|
4
|
+
import { A as useSkill, C as clearSkills, D as hasSkill, E as getSkillInfo, O as listSkills, S as loadSkills, T as getAllSkillInfo, _ as announce, a as summarize, b as loadSkill, c as readAloud, d as extract, f as explain, g as captionImage, h as commit, i as test, k as removeSkill, l as inspectModel, m as compareImages, n as transcribe, o as speak, p as describeImage, r as title, s as review, t as translate, u as extractFromImage, v as analyzeScreenshot, w as defineSkill, x as loadSkillPackage, y as loadProjectSkills } from "../skills-Dsf0op66.mjs";
|
|
5
5
|
|
|
6
6
|
export { analyzeScreenshot, announce, captionImage, clearSkills, commit, compareImages, defineSkill, describeImage, explain, extract, extractFromImage, getAllSkillInfo, getSkillInfo, hasSkill, inspectModel, listSkills, loadProjectSkills, loadSkill, loadSkillPackage, loadSkills, readAloud, removeSkill, review, speak, summarize, test, title, transcribe, translate, useSkill };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { o as getInstance } from "./one-liner-
|
|
1
|
+
import { o as getInstance } from "./one-liner-DTGg6zdm.mjs";
|
|
2
2
|
import { unlinkSync, writeFileSync } from "node:fs";
|
|
3
3
|
import { tmpdir } from "node:os";
|
|
4
4
|
import { join } from "node:path";
|
|
@@ -1587,4 +1587,4 @@ Translate the text to ${to}.`;
|
|
|
1587
1587
|
|
|
1588
1588
|
//#endregion
|
|
1589
1589
|
export { useSkill as A, clearSkills as C, hasSkill as D, getSkillInfo as E, listSkills as O, loadSkills as S, getAllSkillInfo as T, announce as _, summarize as a, loadSkill as b, readAloud as c, extract as d, explain as f, captionImage as g, commit as h, test as i, removeSkill as k, inspectModel as l, compareImages as m, transcribe as n, speak as o, describeImage as p, title as r, review as s, translate as t, extractFromImage as u, analyzeScreenshot as v, defineSkill as w, loadSkillPackage as x, loadProjectSkills as y };
|
|
1590
|
-
//# sourceMappingURL=skills-
|
|
1590
|
+
//# sourceMappingURL=skills-Dsf0op66.mjs.map
|