@tryhamster/gerbil 1.0.0 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +99 -34
- package/dist/browser/index.d.ts +12 -2
- package/dist/browser/index.d.ts.map +1 -1
- package/dist/browser/index.js +12 -5
- package/dist/browser/index.js.map +1 -1
- package/dist/cli.mjs +7 -7
- package/dist/cli.mjs.map +1 -1
- package/dist/frameworks/express.d.mts +1 -1
- package/dist/frameworks/express.mjs +1 -1
- package/dist/frameworks/fastify.d.mts +1 -1
- package/dist/frameworks/fastify.mjs +1 -1
- package/dist/frameworks/hono.d.mts +1 -1
- package/dist/frameworks/hono.mjs +1 -1
- package/dist/frameworks/next.d.mts +3 -3
- package/dist/frameworks/next.mjs +1 -1
- package/dist/frameworks/react.d.mts +1 -1
- package/dist/frameworks/trpc.d.mts +1 -1
- package/dist/frameworks/trpc.mjs +1 -1
- package/dist/gerbil-B-jMOrnE.mjs +4 -0
- package/dist/{gerbil-BT9fCydo.d.mts → gerbil-BetB5xb0.d.mts} +3 -3
- package/dist/{gerbil-BT9fCydo.d.mts.map → gerbil-BetB5xb0.d.mts.map} +1 -1
- package/dist/{gerbil-BHrJJIa4.mjs → gerbil-CV4VpF4_.mjs} +2 -2
- package/dist/{gerbil-BHrJJIa4.mjs.map → gerbil-CV4VpF4_.mjs.map} +1 -1
- package/dist/gpu/hooks.d.mts +166 -1
- package/dist/gpu/hooks.d.mts.map +1 -1
- package/dist/gpu/hooks.mjs +214 -6
- package/dist/gpu/hooks.mjs.map +1 -1
- package/dist/gpu/index.d.mts +2 -2
- package/dist/gpu/index.mjs +2 -2
- package/dist/{gpu-33qCAtHW.mjs → gpu-836grvrv.mjs} +178 -3
- package/dist/gpu-836grvrv.mjs.map +1 -0
- package/dist/index-Dgmb2kE3.d.mts.map +1 -1
- package/dist/{index-jEAL2s-A.d.mts → index-DukkJRMj.d.mts} +104 -12
- package/dist/index-DukkJRMj.d.mts.map +1 -0
- package/dist/index.d.mts +3 -3
- package/dist/index.mjs +4 -4
- package/dist/integrations/ai-sdk.d.mts +1 -1
- package/dist/integrations/ai-sdk.mjs +1 -1
- package/dist/integrations/langchain.d.mts +1 -1
- package/dist/integrations/langchain.mjs +1 -1
- package/dist/integrations/llamaindex.d.mts +1 -1
- package/dist/integrations/llamaindex.mjs +1 -1
- package/dist/integrations/mcp.d.mts +3 -3
- package/dist/integrations/mcp.mjs +4 -4
- package/dist/{mcp-1DaMsaBc.mjs → mcp-BVHI5vzD.mjs} +3 -3
- package/dist/{mcp-1DaMsaBc.mjs.map → mcp-BVHI5vzD.mjs.map} +1 -1
- package/dist/{moonshine-stt-v_P_Ci_m.mjs → moonshine-stt-BzQRl-BO.mjs} +51 -19
- package/dist/{moonshine-stt-v_P_Ci_m.mjs.map → moonshine-stt-BzQRl-BO.mjs.map} +1 -1
- package/dist/moonshine-stt-CIolM_SX.mjs +4 -0
- package/dist/{one-liner-DnQn7HJK.mjs → one-liner-Cn7IEg1G.mjs} +2 -2
- package/dist/{one-liner-DnQn7HJK.mjs.map → one-liner-Cn7IEg1G.mjs.map} +1 -1
- package/dist/{repl-jV5gcJFA.mjs → repl-CKAf2M7H.mjs} +3 -3
- package/dist/skills/index.d.mts +5 -5
- package/dist/skills/index.mjs +3 -3
- package/dist/{skills-DX8D59UH.mjs → skills-uuU5GONV.mjs} +2 -2
- package/dist/{skills-DX8D59UH.mjs.map → skills-uuU5GONV.mjs.map} +1 -1
- package/dist/{types-D6FiR_oh.d.mts → types-LlyYILII.d.mts} +7 -3
- package/dist/types-LlyYILII.d.mts.map +1 -0
- package/package.json +1 -1
- package/dist/gerbil-DomNfIr1.mjs +0 -4
- package/dist/gpu-33qCAtHW.mjs.map +0 -1
- package/dist/index-jEAL2s-A.d.mts.map +0 -1
- package/dist/moonshine-stt-BLyVoRpB.mjs +0 -4
- package/dist/types-D6FiR_oh.d.mts.map +0 -1
|
@@ -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-CV4VpF4_.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-Cn7IEg1G.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"one-liner-
|
|
1
|
+
{"version":3,"file":"one-liner-Cn7IEg1G.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"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import "./gerbil-
|
|
1
|
+
import "./gerbil-CV4VpF4_.mjs";
|
|
2
2
|
import "./utils-DKO55ZmZ.mjs";
|
|
3
|
-
import "./one-liner-
|
|
3
|
+
import "./one-liner-Cn7IEg1G.mjs";
|
|
4
4
|
import "./architectures-C1I5V3Dt.mjs";
|
|
5
|
-
import "./skills-
|
|
5
|
+
import "./skills-uuU5GONV.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,6 +1,6 @@
|
|
|
1
|
-
import "../types-
|
|
2
|
-
import "../index-
|
|
3
|
-
import { t as Gerbil } from "../gerbil-
|
|
1
|
+
import "../types-LlyYILII.mjs";
|
|
2
|
+
import "../index-DukkJRMj.mjs";
|
|
3
|
+
import { t as Gerbil } from "../gerbil-BetB5xb0.mjs";
|
|
4
4
|
import { z } from "zod";
|
|
5
5
|
|
|
6
6
|
//#region src/skills/types.d.ts
|
|
@@ -386,8 +386,8 @@ declare const extract: Skill<{
|
|
|
386
386
|
declare const ExtractFromImageInput: z.ZodObject<{
|
|
387
387
|
image: z.ZodString;
|
|
388
388
|
extract: z.ZodDefault<z.ZodEnum<{
|
|
389
|
-
code: "code";
|
|
390
389
|
text: "text";
|
|
390
|
+
code: "code";
|
|
391
391
|
data: "data";
|
|
392
392
|
table: "table";
|
|
393
393
|
diagram: "diagram";
|
|
@@ -405,7 +405,7 @@ declare const ExtractFromImageInput: z.ZodObject<{
|
|
|
405
405
|
type ExtractFromImageInput = z.infer<typeof ExtractFromImageInput>;
|
|
406
406
|
declare const extractFromImage: Skill<{
|
|
407
407
|
image: string;
|
|
408
|
-
extract: "
|
|
408
|
+
extract: "text" | "code" | "data" | "table" | "diagram" | "form" | "receipt";
|
|
409
409
|
outputFormat: "raw" | "json" | "markdown" | "csv";
|
|
410
410
|
language?: string | undefined;
|
|
411
411
|
}, string>;
|
package/dist/skills/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import "../gerbil-
|
|
1
|
+
import "../gerbil-CV4VpF4_.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-Cn7IEg1G.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-uuU5GONV.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-Cn7IEg1G.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-uuU5GONV.mjs.map
|