@elizaos/plugin-ollama 2.0.0-alpha.11 → 2.0.0-alpha.12

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 (35) hide show
  1. package/dist/browser/index.browser.js +429 -0
  2. package/dist/browser/index.browser.js.map +15 -0
  3. package/dist/browser/index.d.ts +2 -0
  4. package/dist/cjs/index.d.ts +2 -0
  5. package/dist/cjs/index.node.cjs +98 -0
  6. package/dist/cjs/index.node.cjs.map +10 -0
  7. package/dist/node/build.d.ts +2 -0
  8. package/dist/node/build.d.ts.map +1 -0
  9. package/dist/node/generated/specs/specs.d.ts +55 -0
  10. package/dist/node/generated/specs/specs.d.ts.map +1 -0
  11. package/dist/node/index.browser.d.ts +3 -0
  12. package/dist/node/index.browser.d.ts.map +1 -0
  13. package/dist/node/index.d.ts +2 -0
  14. package/dist/node/index.d.ts.map +1 -0
  15. package/dist/node/index.node.js +56 -0
  16. package/dist/node/index.node.js.map +10 -0
  17. package/dist/node/models/availability.d.ts +2 -0
  18. package/dist/node/models/availability.d.ts.map +1 -0
  19. package/dist/node/models/embedding.d.ts +3 -0
  20. package/dist/node/models/embedding.d.ts.map +1 -0
  21. package/dist/node/models/index.d.ts +5 -0
  22. package/dist/node/models/index.d.ts.map +1 -0
  23. package/dist/node/models/object.d.ts +4 -0
  24. package/dist/node/models/object.d.ts.map +1 -0
  25. package/dist/node/models/text.d.ts +4 -0
  26. package/dist/node/models/text.d.ts.map +1 -0
  27. package/dist/node/plugin.d.ts +3 -0
  28. package/dist/node/plugin.d.ts.map +1 -0
  29. package/dist/node/types/index.d.ts +47 -0
  30. package/dist/node/types/index.d.ts.map +1 -0
  31. package/dist/node/utils/config.d.ts +15 -0
  32. package/dist/node/utils/config.d.ts.map +1 -0
  33. package/dist/node/utils/index.d.ts +2 -0
  34. package/dist/node/utils/index.d.ts.map +1 -0
  35. package/package.json +134 -134
@@ -0,0 +1,429 @@
1
+ // plugin.ts
2
+ import { logger as logger5, ModelType } from "@elizaos/core";
3
+
4
+ // models/embedding.ts
5
+ import { logger as logger2 } from "@elizaos/core";
6
+ import { embed } from "ai";
7
+ import { createOllama } from "ollama-ai-provider";
8
+
9
+ // utils/config.ts
10
+ var DEFAULT_OLLAMA_URL = "http://localhost:11434";
11
+ var DEFAULT_SMALL_MODEL = "gemma3:latest";
12
+ var DEFAULT_LARGE_MODEL = "gemma3:latest";
13
+ var DEFAULT_EMBEDDING_MODEL = "nomic-embed-text:latest";
14
+ function getEnvValue(key) {
15
+ if (typeof process === "undefined" || !process.env) {
16
+ return;
17
+ }
18
+ const value = process.env[key];
19
+ return value === undefined ? undefined : String(value);
20
+ }
21
+ function getSetting(runtime, key, defaultValue) {
22
+ const value = runtime.getSetting(key);
23
+ if (value !== undefined && value !== null) {
24
+ return String(value);
25
+ }
26
+ return getEnvValue(key) ?? defaultValue;
27
+ }
28
+ function getBaseURL(runtime) {
29
+ const apiEndpoint = getSetting(runtime, "OLLAMA_API_ENDPOINT") || getSetting(runtime, "OLLAMA_API_URL") || DEFAULT_OLLAMA_URL;
30
+ if (!apiEndpoint.endsWith("/api")) {
31
+ return apiEndpoint.endsWith("/") ? `${apiEndpoint}api` : `${apiEndpoint}/api`;
32
+ }
33
+ return apiEndpoint;
34
+ }
35
+ function getApiBase(runtime) {
36
+ const baseURL = getBaseURL(runtime);
37
+ return baseURL.endsWith("/api") ? baseURL.slice(0, -4) : baseURL;
38
+ }
39
+ function getSmallModel(runtime) {
40
+ return getSetting(runtime, "OLLAMA_SMALL_MODEL") || getSetting(runtime, "SMALL_MODEL") || DEFAULT_SMALL_MODEL;
41
+ }
42
+ function getLargeModel(runtime) {
43
+ return getSetting(runtime, "OLLAMA_LARGE_MODEL") || getSetting(runtime, "LARGE_MODEL") || DEFAULT_LARGE_MODEL;
44
+ }
45
+ function getEmbeddingModel(runtime) {
46
+ return getSetting(runtime, "OLLAMA_EMBEDDING_MODEL") || DEFAULT_EMBEDDING_MODEL;
47
+ }
48
+
49
+ // models/availability.ts
50
+ import { logger } from "@elizaos/core";
51
+ async function ensureModelAvailable(model, providedBaseURL, customFetch) {
52
+ const baseURL = providedBaseURL || "http://localhost:11434/api";
53
+ const apiBase = baseURL.endsWith("/api") ? baseURL.slice(0, -4) : baseURL;
54
+ const fetcher = customFetch ?? fetch;
55
+ try {
56
+ const showRes = await fetcher(`${apiBase}/api/show`, {
57
+ method: "POST",
58
+ headers: { "Content-Type": "application/json" },
59
+ body: JSON.stringify({ model })
60
+ });
61
+ if (showRes.ok) {
62
+ return;
63
+ }
64
+ logger.info(`[Ollama] Model ${model} not found locally. Downloading...`);
65
+ const pullRes = await fetcher(`${apiBase}/api/pull`, {
66
+ method: "POST",
67
+ headers: { "Content-Type": "application/json" },
68
+ body: JSON.stringify({ model, stream: false })
69
+ });
70
+ if (!pullRes.ok) {
71
+ logger.error(`Failed to pull model ${model}: ${pullRes.statusText}`);
72
+ } else {
73
+ logger.info(`[Ollama] Downloaded model ${model}`);
74
+ }
75
+ } catch (err) {
76
+ logger.error({ error: err }, "Error ensuring model availability");
77
+ }
78
+ }
79
+
80
+ // models/embedding.ts
81
+ async function handleTextEmbedding(runtime, params) {
82
+ try {
83
+ const baseURL = getBaseURL(runtime);
84
+ const customFetch = runtime.fetch ?? undefined;
85
+ const ollama = createOllama({
86
+ fetch: customFetch,
87
+ baseURL
88
+ });
89
+ const modelName = getEmbeddingModel(runtime);
90
+ logger2.log(`[Ollama] Using TEXT_EMBEDDING model: ${modelName}`);
91
+ await ensureModelAvailable(modelName, baseURL, customFetch);
92
+ let text = typeof params === "string" ? params : params ? params.text || "" : "";
93
+ const maxChars = 8000 * 4;
94
+ if (text.length > maxChars) {
95
+ logger2.warn(`[Ollama] Embedding input too long (~${Math.ceil(text.length / 4)} tokens), truncating to ~8000 tokens`);
96
+ text = text.slice(0, maxChars);
97
+ }
98
+ const embeddingText = text || "test";
99
+ try {
100
+ const embedParams = {
101
+ model: ollama.embedding(modelName),
102
+ value: embeddingText
103
+ };
104
+ const { embedding } = await embed(embedParams);
105
+ return embedding;
106
+ } catch (embeddingError) {
107
+ logger2.error({ error: embeddingError }, "Error generating embedding");
108
+ return Array(1536).fill(0);
109
+ }
110
+ } catch (error) {
111
+ logger2.error({ error }, "Error in TEXT_EMBEDDING model");
112
+ return Array(1536).fill(0);
113
+ }
114
+ }
115
+
116
+ // models/object.ts
117
+ import { logger as logger3 } from "@elizaos/core";
118
+ import { generateObject } from "ai";
119
+ import { createOllama as createOllama2 } from "ollama-ai-provider";
120
+ async function generateOllamaObject(ollama, model, params) {
121
+ try {
122
+ const generateParams = {
123
+ model: ollama(model),
124
+ output: "no-schema",
125
+ prompt: params.prompt,
126
+ temperature: params.temperature
127
+ };
128
+ const { object } = await generateObject(generateParams);
129
+ return object;
130
+ } catch (error) {
131
+ logger3.error({ error }, "Error generating object");
132
+ return {};
133
+ }
134
+ }
135
+ async function handleObjectSmall(runtime, params) {
136
+ try {
137
+ const baseURL = getBaseURL(runtime);
138
+ const customFetch = runtime.fetch ?? undefined;
139
+ const ollama = createOllama2({
140
+ fetch: customFetch,
141
+ baseURL
142
+ });
143
+ const model = getSmallModel(runtime);
144
+ logger3.log(`[Ollama] Using OBJECT_SMALL model: ${model}`);
145
+ await ensureModelAvailable(model, baseURL, customFetch);
146
+ return await generateOllamaObject(ollama, model, params);
147
+ } catch (error) {
148
+ logger3.error({ error }, "Error in OBJECT_SMALL model");
149
+ return {};
150
+ }
151
+ }
152
+ async function handleObjectLarge(runtime, params) {
153
+ try {
154
+ const baseURL = getBaseURL(runtime);
155
+ const customFetch = runtime.fetch ?? undefined;
156
+ const ollama = createOllama2({
157
+ fetch: customFetch,
158
+ baseURL
159
+ });
160
+ const model = getLargeModel(runtime);
161
+ logger3.log(`[Ollama] Using OBJECT_LARGE model: ${model}`);
162
+ await ensureModelAvailable(model, baseURL, customFetch);
163
+ return await generateOllamaObject(ollama, model, params);
164
+ } catch (error) {
165
+ logger3.error({ error }, "Error in OBJECT_LARGE model");
166
+ return {};
167
+ }
168
+ }
169
+
170
+ // models/text.ts
171
+ import { logger as logger4 } from "@elizaos/core";
172
+ import { generateText } from "ai";
173
+ import { createOllama as createOllama3 } from "ollama-ai-provider";
174
+ async function generateOllamaText(ollama, model, params) {
175
+ try {
176
+ const generateParams = {
177
+ model: ollama(model),
178
+ prompt: params.prompt,
179
+ system: params.system,
180
+ temperature: params.temperature,
181
+ maxTokens: params.maxTokens,
182
+ frequencyPenalty: params.frequencyPenalty,
183
+ presencePenalty: params.presencePenalty,
184
+ stopSequences: params.stopSequences
185
+ };
186
+ const { text: ollamaResponse } = await generateText(generateParams);
187
+ return ollamaResponse;
188
+ } catch (error) {
189
+ logger4.error({ error }, "Error in generateOllamaText");
190
+ return "Error generating text. Please try again later.";
191
+ }
192
+ }
193
+ async function handleTextSmall(runtime, { prompt, stopSequences = [] }) {
194
+ try {
195
+ const temperature = 0.7;
196
+ const frequency_penalty = 0.7;
197
+ const presence_penalty = 0.7;
198
+ const max_response_length = 8000;
199
+ const baseURL = getBaseURL(runtime);
200
+ const customFetch = runtime.fetch ?? undefined;
201
+ const ollama = createOllama3({
202
+ fetch: customFetch,
203
+ baseURL
204
+ });
205
+ const model = getSmallModel(runtime);
206
+ logger4.log(`[Ollama] Using TEXT_SMALL model: ${model}`);
207
+ await ensureModelAvailable(model, baseURL, customFetch);
208
+ return await generateOllamaText(ollama, model, {
209
+ prompt,
210
+ system: runtime.character?.system ?? undefined,
211
+ temperature,
212
+ maxTokens: max_response_length,
213
+ frequencyPenalty: frequency_penalty,
214
+ presencePenalty: presence_penalty,
215
+ stopSequences
216
+ });
217
+ } catch (error) {
218
+ logger4.error({ error }, "Error in TEXT_SMALL model");
219
+ return "Error generating text. Please try again later.";
220
+ }
221
+ }
222
+ async function handleTextLarge(runtime, {
223
+ prompt,
224
+ stopSequences = [],
225
+ maxTokens = 8192,
226
+ temperature = 0.7,
227
+ frequencyPenalty = 0.7,
228
+ presencePenalty = 0.7
229
+ }) {
230
+ try {
231
+ const model = getLargeModel(runtime);
232
+ const baseURL = getBaseURL(runtime);
233
+ const customFetch = runtime.fetch ?? undefined;
234
+ const ollama = createOllama3({
235
+ fetch: customFetch,
236
+ baseURL
237
+ });
238
+ logger4.log(`[Ollama] Using TEXT_LARGE model: ${model}`);
239
+ await ensureModelAvailable(model, baseURL, customFetch);
240
+ return await generateOllamaText(ollama, model, {
241
+ prompt,
242
+ system: runtime.character?.system ?? undefined,
243
+ temperature,
244
+ maxTokens,
245
+ frequencyPenalty,
246
+ presencePenalty,
247
+ stopSequences
248
+ });
249
+ } catch (error) {
250
+ logger4.error({ error }, "Error in TEXT_LARGE model");
251
+ return "Error generating text. Please try again later.";
252
+ }
253
+ }
254
+
255
+ // plugin.ts
256
+ var _globalThis = globalThis;
257
+ _globalThis.AI_SDK_LOG_WARNINGS ??= false;
258
+ function getProcessEnv() {
259
+ if (typeof process === "undefined" || !process.env) {
260
+ return {};
261
+ }
262
+ return process.env;
263
+ }
264
+ var env = getProcessEnv();
265
+ var ollamaPlugin = {
266
+ name: "ollama",
267
+ description: "Ollama plugin for local LLM inference",
268
+ config: {
269
+ OLLAMA_API_ENDPOINT: env.OLLAMA_API_ENDPOINT ?? null,
270
+ OLLAMA_SMALL_MODEL: env.OLLAMA_SMALL_MODEL ?? null,
271
+ OLLAMA_MEDIUM_MODEL: env.OLLAMA_MEDIUM_MODEL ?? null,
272
+ OLLAMA_LARGE_MODEL: env.OLLAMA_LARGE_MODEL ?? null,
273
+ OLLAMA_EMBEDDING_MODEL: env.OLLAMA_EMBEDDING_MODEL ?? null
274
+ },
275
+ async init(_config, runtime) {
276
+ const baseURL = getBaseURL(runtime);
277
+ const apiBase = getApiBase(runtime);
278
+ if (!baseURL || baseURL === "http://localhost:11434/api") {
279
+ const endpoint = runtime.getSetting("OLLAMA_API_ENDPOINT");
280
+ if (!endpoint) {
281
+ logger5.warn("OLLAMA_API_ENDPOINT not set, using default localhost:11434");
282
+ }
283
+ }
284
+ try {
285
+ const response = await fetch(`${apiBase}/api/tags`, {
286
+ method: "GET",
287
+ headers: { "Content-Type": "application/json" }
288
+ });
289
+ if (!response.ok) {
290
+ logger5.warn(`Ollama API validation failed: ${response.statusText}`);
291
+ }
292
+ } catch (fetchError) {
293
+ const message = fetchError instanceof Error ? fetchError.message : String(fetchError);
294
+ logger5.warn(`Ollama API validation error: ${message}`);
295
+ }
296
+ },
297
+ models: {
298
+ [ModelType.TEXT_EMBEDDING]: async (runtime, params) => {
299
+ return handleTextEmbedding(runtime, params);
300
+ },
301
+ [ModelType.TEXT_SMALL]: async (runtime, params) => {
302
+ return handleTextSmall(runtime, params);
303
+ },
304
+ [ModelType.TEXT_LARGE]: async (runtime, params) => {
305
+ return handleTextLarge(runtime, params);
306
+ },
307
+ [ModelType.OBJECT_SMALL]: async (runtime, params) => {
308
+ return handleObjectSmall(runtime, params);
309
+ },
310
+ [ModelType.OBJECT_LARGE]: async (runtime, params) => {
311
+ return handleObjectLarge(runtime, params);
312
+ }
313
+ },
314
+ tests: [
315
+ {
316
+ name: "ollama_plugin_tests",
317
+ tests: [
318
+ {
319
+ name: "ollama_test_url_validation",
320
+ fn: async (runtime) => {
321
+ try {
322
+ const apiBase = getApiBase(runtime);
323
+ const response = await fetch(`${apiBase}/api/tags`);
324
+ if (!response.ok) {
325
+ logger5.error(`Failed to validate Ollama API: ${response.statusText}`);
326
+ }
327
+ } catch (error) {
328
+ logger5.error({ error }, "Error in ollama_test_url_validation");
329
+ }
330
+ }
331
+ },
332
+ {
333
+ name: "ollama_test_text_embedding",
334
+ fn: async (runtime) => {
335
+ try {
336
+ const embedding = await runtime.useModel(ModelType.TEXT_EMBEDDING, {
337
+ text: "Hello, world!"
338
+ });
339
+ logger5.log({ embedding }, "Generated embedding");
340
+ } catch (error) {
341
+ logger5.error({ error }, "Error in test_text_embedding");
342
+ }
343
+ }
344
+ },
345
+ {
346
+ name: "ollama_test_text_large",
347
+ fn: async (runtime) => {
348
+ try {
349
+ const text = await runtime.useModel(ModelType.TEXT_LARGE, {
350
+ prompt: "What is the nature of reality in 10 words?"
351
+ });
352
+ if (text.length === 0) {
353
+ logger5.error("Failed to generate text");
354
+ return;
355
+ }
356
+ logger5.log({ text }, "Generated with test_text_large");
357
+ } catch (error) {
358
+ logger5.error({ error }, "Error in test_text_large");
359
+ }
360
+ }
361
+ },
362
+ {
363
+ name: "ollama_test_text_small",
364
+ fn: async (runtime) => {
365
+ try {
366
+ const text = await runtime.useModel(ModelType.TEXT_SMALL, {
367
+ prompt: "What is the nature of reality in 10 words?"
368
+ });
369
+ if (text.length === 0) {
370
+ logger5.error("Failed to generate text");
371
+ return;
372
+ }
373
+ logger5.log({ text }, "Generated with test_text_small");
374
+ } catch (error) {
375
+ logger5.error({ error }, "Error in test_text_small");
376
+ }
377
+ }
378
+ },
379
+ {
380
+ name: "ollama_test_object_small",
381
+ fn: async (runtime) => {
382
+ try {
383
+ const object = await runtime.useModel(ModelType.OBJECT_SMALL, {
384
+ prompt: "Generate a JSON object representing a user profile with name, age, and hobbies",
385
+ temperature: 0.7,
386
+ schema: undefined
387
+ });
388
+ logger5.log({ object }, "Generated object");
389
+ } catch (error) {
390
+ logger5.error({ error }, "Error in test_object_small");
391
+ }
392
+ }
393
+ },
394
+ {
395
+ name: "ollama_test_object_large",
396
+ fn: async (runtime) => {
397
+ try {
398
+ const object = await runtime.useModel(ModelType.OBJECT_LARGE, {
399
+ prompt: "Generate a detailed JSON object representing a restaurant with name, cuisine type, menu items with prices, and customer reviews",
400
+ temperature: 0.7,
401
+ schema: undefined
402
+ });
403
+ logger5.log({ object }, "Generated object");
404
+ } catch (error) {
405
+ logger5.error({ error }, "Error in test_object_large");
406
+ }
407
+ }
408
+ }
409
+ ]
410
+ }
411
+ ]
412
+ };
413
+ export {
414
+ ollamaPlugin,
415
+ getSmallModel,
416
+ getSetting,
417
+ getLargeModel,
418
+ getEmbeddingModel,
419
+ getBaseURL,
420
+ getApiBase,
421
+ default2 as default,
422
+ DEFAULT_SMALL_MODEL,
423
+ DEFAULT_OLLAMA_URL,
424
+ DEFAULT_LARGE_MODEL,
425
+ DEFAULT_EMBEDDING_MODEL
426
+ };
427
+
428
+ //# debugId=1B448803DF37FD5464756E2164756E21
429
+ //# sourceMappingURL=index.browser.js.map
@@ -0,0 +1,15 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../plugin.ts", "../../models/embedding.ts", "../../utils/config.ts", "../../models/availability.ts", "../../models/object.ts", "../../models/text.ts"],
4
+ "sourcesContent": [
5
+ "import type {\n\tGenerateTextParams,\n\tIAgentRuntime,\n\tObjectGenerationParams,\n\tPlugin,\n\tTextEmbeddingParams,\n} from \"@elizaos/core\";\nimport { logger, ModelType } from \"@elizaos/core\";\n\nconst _globalThis = globalThis as typeof globalThis & {\n\tAI_SDK_LOG_WARNINGS?: boolean;\n};\n_globalThis.AI_SDK_LOG_WARNINGS ??= false;\n\nimport { handleTextEmbedding } from \"./models/embedding\";\nimport { handleObjectLarge, handleObjectSmall } from \"./models/object\";\nimport { handleTextLarge, handleTextSmall } from \"./models/text\";\nimport { getApiBase, getBaseURL } from \"./utils/config\";\n\ntype ProcessEnvLike = Record<string, string | undefined>;\n\nfunction getProcessEnv(): ProcessEnvLike {\n\tif (typeof process === \"undefined\" || !process.env) {\n\t\treturn {};\n\t}\n\treturn process.env as ProcessEnvLike;\n}\n\nconst env = getProcessEnv();\n\nexport const ollamaPlugin: Plugin = {\n\tname: \"ollama\",\n\tdescription: \"Ollama plugin for local LLM inference\",\n\n\tconfig: {\n\t\tOLLAMA_API_ENDPOINT: env.OLLAMA_API_ENDPOINT ?? null,\n\t\tOLLAMA_SMALL_MODEL: env.OLLAMA_SMALL_MODEL ?? null,\n\t\tOLLAMA_MEDIUM_MODEL: env.OLLAMA_MEDIUM_MODEL ?? null,\n\t\tOLLAMA_LARGE_MODEL: env.OLLAMA_LARGE_MODEL ?? null,\n\t\tOLLAMA_EMBEDDING_MODEL: env.OLLAMA_EMBEDDING_MODEL ?? null,\n\t},\n\n\tasync init(_config, runtime) {\n\t\tconst baseURL = getBaseURL(runtime);\n\t\tconst apiBase = getApiBase(runtime);\n\n\t\tif (!baseURL || baseURL === \"http://localhost:11434/api\") {\n\t\t\tconst endpoint = runtime.getSetting(\"OLLAMA_API_ENDPOINT\");\n\t\t\tif (!endpoint) {\n\t\t\t\tlogger.warn(\n\t\t\t\t\t\"OLLAMA_API_ENDPOINT not set, using default localhost:11434\",\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\ttry {\n\t\t\tconst response = await fetch(`${apiBase}/api/tags`, {\n\t\t\t\tmethod: \"GET\",\n\t\t\t\theaders: { \"Content-Type\": \"application/json\" },\n\t\t\t});\n\n\t\t\tif (!response.ok) {\n\t\t\t\tlogger.warn(`Ollama API validation failed: ${response.statusText}`);\n\t\t\t}\n\t\t} catch (fetchError: unknown) {\n\t\t\tconst message =\n\t\t\t\tfetchError instanceof Error ? fetchError.message : String(fetchError);\n\t\t\tlogger.warn(`Ollama API validation error: ${message}`);\n\t\t}\n\t},\n\n\tmodels: {\n\t\t[ModelType.TEXT_EMBEDDING]: async (\n\t\t\truntime: IAgentRuntime,\n\t\t\tparams: TextEmbeddingParams | string | null,\n\t\t): Promise<number[]> => {\n\t\t\treturn handleTextEmbedding(runtime, params);\n\t\t},\n\n\t\t[ModelType.TEXT_SMALL]: async (\n\t\t\truntime: IAgentRuntime,\n\t\t\tparams: GenerateTextParams,\n\t\t): Promise<string> => {\n\t\t\treturn handleTextSmall(runtime, params);\n\t\t},\n\n\t\t[ModelType.TEXT_LARGE]: async (\n\t\t\truntime: IAgentRuntime,\n\t\t\tparams: GenerateTextParams,\n\t\t): Promise<string> => {\n\t\t\treturn handleTextLarge(runtime, params);\n\t\t},\n\n\t\t[ModelType.OBJECT_SMALL]: async (\n\t\t\truntime: IAgentRuntime,\n\t\t\tparams: ObjectGenerationParams,\n\t\t): Promise<Record<string, string | number | boolean | null>> => {\n\t\t\treturn handleObjectSmall(runtime, params);\n\t\t},\n\n\t\t[ModelType.OBJECT_LARGE]: async (\n\t\t\truntime: IAgentRuntime,\n\t\t\tparams: ObjectGenerationParams,\n\t\t): Promise<Record<string, string | number | boolean | null>> => {\n\t\t\treturn handleObjectLarge(runtime, params);\n\t\t},\n\t},\n\n\ttests: [\n\t\t{\n\t\t\tname: \"ollama_plugin_tests\",\n\t\t\ttests: [\n\t\t\t\t{\n\t\t\t\t\tname: \"ollama_test_url_validation\",\n\t\t\t\t\tfn: async (runtime: IAgentRuntime) => {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tconst apiBase = getApiBase(runtime);\n\t\t\t\t\t\t\tconst response = await fetch(`${apiBase}/api/tags`);\n\t\t\t\t\t\t\tif (!response.ok) {\n\t\t\t\t\t\t\t\tlogger.error(\n\t\t\t\t\t\t\t\t\t`Failed to validate Ollama API: ${response.statusText}`,\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\t\tlogger.error({ error }, \"Error in ollama_test_url_validation\");\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tname: \"ollama_test_text_embedding\",\n\t\t\t\t\tfn: async (runtime: IAgentRuntime) => {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tconst embedding = await runtime.useModel(\n\t\t\t\t\t\t\t\tModelType.TEXT_EMBEDDING,\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\ttext: \"Hello, world!\",\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tlogger.log({ embedding }, \"Generated embedding\");\n\t\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\t\tlogger.error({ error }, \"Error in test_text_embedding\");\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tname: \"ollama_test_text_large\",\n\t\t\t\t\tfn: async (runtime: IAgentRuntime) => {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tconst text = await runtime.useModel(ModelType.TEXT_LARGE, {\n\t\t\t\t\t\t\t\tprompt: \"What is the nature of reality in 10 words?\",\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tif (text.length === 0) {\n\t\t\t\t\t\t\t\tlogger.error(\"Failed to generate text\");\n\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tlogger.log({ text }, \"Generated with test_text_large\");\n\t\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\t\tlogger.error({ error }, \"Error in test_text_large\");\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tname: \"ollama_test_text_small\",\n\t\t\t\t\tfn: async (runtime: IAgentRuntime) => {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tconst text = await runtime.useModel(ModelType.TEXT_SMALL, {\n\t\t\t\t\t\t\t\tprompt: \"What is the nature of reality in 10 words?\",\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tif (text.length === 0) {\n\t\t\t\t\t\t\t\tlogger.error(\"Failed to generate text\");\n\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tlogger.log({ text }, \"Generated with test_text_small\");\n\t\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\t\tlogger.error({ error }, \"Error in test_text_small\");\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tname: \"ollama_test_object_small\",\n\t\t\t\t\tfn: async (runtime: IAgentRuntime) => {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tconst object = await runtime.useModel(ModelType.OBJECT_SMALL, {\n\t\t\t\t\t\t\t\tprompt:\n\t\t\t\t\t\t\t\t\t\"Generate a JSON object representing a user profile with name, age, and hobbies\",\n\t\t\t\t\t\t\t\ttemperature: 0.7,\n\t\t\t\t\t\t\t\tschema: undefined,\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tlogger.log({ object }, \"Generated object\");\n\t\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\t\tlogger.error({ error }, \"Error in test_object_small\");\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tname: \"ollama_test_object_large\",\n\t\t\t\t\tfn: async (runtime: IAgentRuntime) => {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tconst object = await runtime.useModel(ModelType.OBJECT_LARGE, {\n\t\t\t\t\t\t\t\tprompt:\n\t\t\t\t\t\t\t\t\t\"Generate a detailed JSON object representing a restaurant with name, cuisine type, menu items with prices, and customer reviews\",\n\t\t\t\t\t\t\t\ttemperature: 0.7,\n\t\t\t\t\t\t\t\tschema: undefined,\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tlogger.log({ object }, \"Generated object\");\n\t\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\t\tlogger.error({ error }, \"Error in test_object_large\");\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t],\n};\n",
6
+ "import type { IAgentRuntime, TextEmbeddingParams } from \"@elizaos/core\";\nimport { logger } from \"@elizaos/core\";\nimport { embed } from \"ai\";\nimport { createOllama } from \"ollama-ai-provider\";\n\nimport { getBaseURL, getEmbeddingModel } from \"../utils/config\";\nimport { ensureModelAvailable } from \"./availability\";\n\nexport async function handleTextEmbedding(\n\truntime: IAgentRuntime,\n\tparams: TextEmbeddingParams | string | null,\n): Promise<number[]> {\n\ttry {\n\t\tconst baseURL = getBaseURL(runtime);\n\t\tconst customFetch = runtime.fetch ?? undefined;\n\t\tconst ollama = createOllama({\n\t\t\tfetch: customFetch,\n\t\t\tbaseURL,\n\t\t});\n\n\t\tconst modelName = getEmbeddingModel(runtime);\n\t\tlogger.log(`[Ollama] Using TEXT_EMBEDDING model: ${modelName}`);\n\t\tawait ensureModelAvailable(modelName, baseURL, customFetch);\n\n\t\tlet text =\n\t\t\ttypeof params === \"string\"\n\t\t\t\t? params\n\t\t\t\t: params\n\t\t\t\t\t? (params as TextEmbeddingParams).text || \"\"\n\t\t\t\t\t: \"\";\n\n\t\t// Truncate to stay within embedding model token limits (~4 chars per token)\n\t\tconst maxChars = 8_000 * 4;\n\t\tif (text.length > maxChars) {\n\t\t\tlogger.warn(\n\t\t\t\t`[Ollama] Embedding input too long (~${Math.ceil(text.length / 4)} tokens), truncating to ~8000 tokens`,\n\t\t\t);\n\t\t\ttext = text.slice(0, maxChars);\n\t\t}\n\n\t\tconst embeddingText = text || \"test\";\n\n\t\ttry {\n\t\t\tconst embedParams = {\n\t\t\t\tmodel: ollama.embedding(modelName),\n\t\t\t\tvalue: embeddingText,\n\t\t\t};\n\n\t\t\tconst { embedding } = await embed(embedParams);\n\t\t\treturn embedding;\n\t\t} catch (embeddingError) {\n\t\t\tlogger.error({ error: embeddingError }, \"Error generating embedding\");\n\t\t\treturn Array(1536).fill(0);\n\t\t}\n\t} catch (error) {\n\t\tlogger.error({ error }, \"Error in TEXT_EMBEDDING model\");\n\t\treturn Array(1536).fill(0);\n\t}\n}\n",
7
+ "type SettingsProvider = {\n\tgetSetting: (key: string) => string | number | boolean | null;\n};\n\nexport const DEFAULT_OLLAMA_URL = \"http://localhost:11434\";\nexport const DEFAULT_SMALL_MODEL = \"gemma3:latest\";\nexport const DEFAULT_LARGE_MODEL = \"gemma3:latest\";\nexport const DEFAULT_EMBEDDING_MODEL = \"nomic-embed-text:latest\";\n\nfunction getEnvValue(key: string): string | undefined {\n\tif (typeof process === \"undefined\" || !process.env) {\n\t\treturn undefined;\n\t}\n\tconst value = process.env[key];\n\treturn value === undefined ? undefined : String(value);\n}\n\nexport function getSetting(\n\truntime: SettingsProvider,\n\tkey: string,\n\tdefaultValue?: string,\n): string | undefined {\n\tconst value = runtime.getSetting(key);\n\tif (value !== undefined && value !== null) {\n\t\treturn String(value);\n\t}\n\treturn getEnvValue(key) ?? defaultValue;\n}\n\nexport function getBaseURL(runtime: SettingsProvider): string {\n\tconst apiEndpoint =\n\t\tgetSetting(runtime, \"OLLAMA_API_ENDPOINT\") ||\n\t\tgetSetting(runtime, \"OLLAMA_API_URL\") ||\n\t\tDEFAULT_OLLAMA_URL;\n\n\tif (!apiEndpoint.endsWith(\"/api\")) {\n\t\treturn apiEndpoint.endsWith(\"/\")\n\t\t\t? `${apiEndpoint}api`\n\t\t\t: `${apiEndpoint}/api`;\n\t}\n\treturn apiEndpoint;\n}\n\nexport function getApiBase(runtime: SettingsProvider): string {\n\tconst baseURL = getBaseURL(runtime);\n\treturn baseURL.endsWith(\"/api\") ? baseURL.slice(0, -4) : baseURL;\n}\n\nexport function getSmallModel(runtime: SettingsProvider): string {\n\treturn (\n\t\tgetSetting(runtime, \"OLLAMA_SMALL_MODEL\") ||\n\t\tgetSetting(runtime, \"SMALL_MODEL\") ||\n\t\tDEFAULT_SMALL_MODEL\n\t);\n}\n\nexport function getLargeModel(runtime: SettingsProvider): string {\n\treturn (\n\t\tgetSetting(runtime, \"OLLAMA_LARGE_MODEL\") ||\n\t\tgetSetting(runtime, \"LARGE_MODEL\") ||\n\t\tDEFAULT_LARGE_MODEL\n\t);\n}\n\nexport function getEmbeddingModel(runtime: SettingsProvider): string {\n\treturn (\n\t\tgetSetting(runtime, \"OLLAMA_EMBEDDING_MODEL\") || DEFAULT_EMBEDDING_MODEL\n\t);\n}\n",
8
+ "import { logger } from \"@elizaos/core\";\n\nexport async function ensureModelAvailable(\n\tmodel: string,\n\tprovidedBaseURL?: string,\n\tcustomFetch?: typeof fetch | null,\n): Promise<void> {\n\tconst baseURL = providedBaseURL || \"http://localhost:11434/api\";\n\tconst apiBase = baseURL.endsWith(\"/api\") ? baseURL.slice(0, -4) : baseURL;\n\tconst fetcher = customFetch ?? fetch;\n\n\ttry {\n\t\tconst showRes = await fetcher(`${apiBase}/api/show`, {\n\t\t\tmethod: \"POST\",\n\t\t\theaders: { \"Content-Type\": \"application/json\" },\n\t\t\tbody: JSON.stringify({ model }),\n\t\t});\n\n\t\tif (showRes.ok) {\n\t\t\treturn;\n\t\t}\n\n\t\tlogger.info(`[Ollama] Model ${model} not found locally. Downloading...`);\n\n\t\tconst pullRes = await fetcher(`${apiBase}/api/pull`, {\n\t\t\tmethod: \"POST\",\n\t\t\theaders: { \"Content-Type\": \"application/json\" },\n\t\t\tbody: JSON.stringify({ model, stream: false }),\n\t\t});\n\n\t\tif (!pullRes.ok) {\n\t\t\tlogger.error(`Failed to pull model ${model}: ${pullRes.statusText}`);\n\t\t} else {\n\t\t\tlogger.info(`[Ollama] Downloaded model ${model}`);\n\t\t}\n\t} catch (err) {\n\t\tlogger.error({ error: err }, \"Error ensuring model availability\");\n\t}\n}\n",
9
+ "import type { IAgentRuntime, ObjectGenerationParams } from \"@elizaos/core\";\nimport { logger } from \"@elizaos/core\";\nimport { generateObject } from \"ai\";\nimport { createOllama } from \"ollama-ai-provider\";\n\nimport { getBaseURL, getLargeModel, getSmallModel } from \"../utils/config\";\nimport { ensureModelAvailable } from \"./availability\";\n\nasync function generateOllamaObject(\n\tollama: ReturnType<typeof createOllama>,\n\tmodel: string,\n\tparams: ObjectGenerationParams,\n): Promise<Record<string, string | number | boolean | null>> {\n\ttry {\n\t\tconst generateParams = {\n\t\t\tmodel: ollama(model),\n\t\t\toutput: \"no-schema\" as const,\n\t\t\tprompt: params.prompt,\n\t\t\ttemperature: params.temperature,\n\t\t};\n\n\t\tconst { object } = await generateObject(generateParams);\n\t\treturn object as Record<string, string | number | boolean | null>;\n\t} catch (error: unknown) {\n\t\tlogger.error({ error }, \"Error generating object\");\n\t\treturn {};\n\t}\n}\n\nexport async function handleObjectSmall(\n\truntime: IAgentRuntime,\n\tparams: ObjectGenerationParams,\n): Promise<Record<string, string | number | boolean | null>> {\n\ttry {\n\t\tconst baseURL = getBaseURL(runtime);\n\t\tconst customFetch = runtime.fetch ?? undefined;\n\t\tconst ollama = createOllama({\n\t\t\tfetch: customFetch,\n\t\t\tbaseURL,\n\t\t});\n\t\tconst model = getSmallModel(runtime);\n\n\t\tlogger.log(`[Ollama] Using OBJECT_SMALL model: ${model}`);\n\t\tawait ensureModelAvailable(model, baseURL, customFetch);\n\n\t\treturn await generateOllamaObject(ollama, model, params);\n\t} catch (error) {\n\t\tlogger.error({ error }, \"Error in OBJECT_SMALL model\");\n\t\treturn {};\n\t}\n}\n\nexport async function handleObjectLarge(\n\truntime: IAgentRuntime,\n\tparams: ObjectGenerationParams,\n): Promise<Record<string, string | number | boolean | null>> {\n\ttry {\n\t\tconst baseURL = getBaseURL(runtime);\n\t\tconst customFetch = runtime.fetch ?? undefined;\n\t\tconst ollama = createOllama({\n\t\t\tfetch: customFetch,\n\t\t\tbaseURL,\n\t\t});\n\t\tconst model = getLargeModel(runtime);\n\n\t\tlogger.log(`[Ollama] Using OBJECT_LARGE model: ${model}`);\n\t\tawait ensureModelAvailable(model, baseURL, customFetch);\n\n\t\treturn await generateOllamaObject(ollama, model, params);\n\t} catch (error) {\n\t\tlogger.error({ error }, \"Error in OBJECT_LARGE model\");\n\t\treturn {};\n\t}\n}\n",
10
+ "import type { GenerateTextParams, IAgentRuntime } from \"@elizaos/core\";\nimport { logger } from \"@elizaos/core\";\nimport { generateText } from \"ai\";\nimport { createOllama } from \"ollama-ai-provider\";\n\nimport { getBaseURL, getLargeModel, getSmallModel } from \"../utils/config\";\nimport { ensureModelAvailable } from \"./availability\";\n\nasync function generateOllamaText(\n\tollama: ReturnType<typeof createOllama>,\n\tmodel: string,\n\tparams: {\n\t\tprompt: string;\n\t\tsystem?: string;\n\t\ttemperature: number;\n\t\tmaxTokens: number;\n\t\tfrequencyPenalty: number;\n\t\tpresencePenalty: number;\n\t\tstopSequences: string[];\n\t},\n): Promise<string> {\n\ttry {\n\t\tconst generateParams = {\n\t\t\tmodel: ollama(model),\n\t\t\tprompt: params.prompt,\n\t\t\tsystem: params.system,\n\t\t\ttemperature: params.temperature,\n\t\t\tmaxTokens: params.maxTokens,\n\t\t\tfrequencyPenalty: params.frequencyPenalty,\n\t\t\tpresencePenalty: params.presencePenalty,\n\t\t\tstopSequences: params.stopSequences,\n\t\t};\n\n\t\tconst { text: ollamaResponse } = await generateText(generateParams);\n\t\treturn ollamaResponse;\n\t} catch (error: unknown) {\n\t\tlogger.error({ error }, \"Error in generateOllamaText\");\n\t\treturn \"Error generating text. Please try again later.\";\n\t}\n}\n\nexport async function handleTextSmall(\n\truntime: IAgentRuntime,\n\t{ prompt, stopSequences = [] }: GenerateTextParams,\n): Promise<string> {\n\ttry {\n\t\tconst temperature = 0.7;\n\t\tconst frequency_penalty = 0.7;\n\t\tconst presence_penalty = 0.7;\n\t\tconst max_response_length = 8000;\n\n\t\tconst baseURL = getBaseURL(runtime);\n\t\tconst customFetch = runtime.fetch ?? undefined;\n\t\tconst ollama = createOllama({\n\t\t\tfetch: customFetch,\n\t\t\tbaseURL,\n\t\t});\n\n\t\tconst model = getSmallModel(runtime);\n\t\tlogger.log(`[Ollama] Using TEXT_SMALL model: ${model}`);\n\t\tawait ensureModelAvailable(model, baseURL, customFetch);\n\n\t\treturn await generateOllamaText(ollama, model, {\n\t\t\tprompt,\n\t\t\tsystem: runtime.character?.system ?? undefined,\n\t\t\ttemperature,\n\t\t\tmaxTokens: max_response_length,\n\t\t\tfrequencyPenalty: frequency_penalty,\n\t\t\tpresencePenalty: presence_penalty,\n\t\t\tstopSequences,\n\t\t});\n\t} catch (error) {\n\t\tlogger.error({ error }, \"Error in TEXT_SMALL model\");\n\t\treturn \"Error generating text. Please try again later.\";\n\t}\n}\n\nexport async function handleTextLarge(\n\truntime: IAgentRuntime,\n\t{\n\t\tprompt,\n\t\tstopSequences = [],\n\t\tmaxTokens = 8192,\n\t\ttemperature = 0.7,\n\t\tfrequencyPenalty = 0.7,\n\t\tpresencePenalty = 0.7,\n\t}: GenerateTextParams,\n): Promise<string> {\n\ttry {\n\t\tconst model = getLargeModel(runtime);\n\t\tconst baseURL = getBaseURL(runtime);\n\t\tconst customFetch = runtime.fetch ?? undefined;\n\t\tconst ollama = createOllama({\n\t\t\tfetch: customFetch,\n\t\t\tbaseURL,\n\t\t});\n\n\t\tlogger.log(`[Ollama] Using TEXT_LARGE model: ${model}`);\n\t\tawait ensureModelAvailable(model, baseURL, customFetch);\n\t\treturn await generateOllamaText(ollama, model, {\n\t\t\tprompt,\n\t\t\tsystem: runtime.character?.system ?? undefined,\n\t\t\ttemperature,\n\t\t\tmaxTokens,\n\t\t\tfrequencyPenalty,\n\t\t\tpresencePenalty,\n\t\t\tstopSequences,\n\t\t});\n\t} catch (error) {\n\t\tlogger.error({ error }, \"Error in TEXT_LARGE model\");\n\t\treturn \"Error generating text. Please try again later.\";\n\t}\n}\n"
11
+ ],
12
+ "mappings": ";AAOA,mBAAS;;;ACNT,mBAAS;AACT;AACA;;;ACCO,IAAM,qBAAqB;AAC3B,IAAM,sBAAsB;AAC5B,IAAM,sBAAsB;AAC5B,IAAM,0BAA0B;AAEvC,SAAS,WAAW,CAAC,KAAiC;AAAA,EACrD,IAAI,OAAO,YAAY,eAAe,CAAC,QAAQ,KAAK;AAAA,IACnD;AAAA,EACD;AAAA,EACA,MAAM,QAAQ,QAAQ,IAAI;AAAA,EAC1B,OAAO,UAAU,YAAY,YAAY,OAAO,KAAK;AAAA;AAG/C,SAAS,UAAU,CACzB,SACA,KACA,cACqB;AAAA,EACrB,MAAM,QAAQ,QAAQ,WAAW,GAAG;AAAA,EACpC,IAAI,UAAU,aAAa,UAAU,MAAM;AAAA,IAC1C,OAAO,OAAO,KAAK;AAAA,EACpB;AAAA,EACA,OAAO,YAAY,GAAG,KAAK;AAAA;AAGrB,SAAS,UAAU,CAAC,SAAmC;AAAA,EAC7D,MAAM,cACL,WAAW,SAAS,qBAAqB,KACzC,WAAW,SAAS,gBAAgB,KACpC;AAAA,EAED,IAAI,CAAC,YAAY,SAAS,MAAM,GAAG;AAAA,IAClC,OAAO,YAAY,SAAS,GAAG,IAC5B,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YAA2B;AAAA,YACrC,IAAI;AAAA,cACH,MAAM,OAAO,MAAM,QAAQ,SAAS,UAAU,YAAY;AAAA,gBACzD,QAAQ;AAAA,cACT,CAAC;AAAA,cACD,IAAI,KAAK,WAAW,GAAG;AAAA,gBACtB,QAAO,MAAM,yBAAyB;AAAA,gBACtC;AAAA,cACD;AAAA,cACA,QAAO,IAAI,EAAE,KAAK,GAAG,gCAAgC;AAAA,cACpD,OAAO,OAAO;AAAA,cACf,QAAO,MAAM,EAAE,MAAM,GAAG,0BAA0B;AAAA;AAAA;AAAA,QAGrD;AAAA,QACA;AAAA,UACC,MAAM;AAAA,UACN,IAAI,OAAO,YAA2B;AAAA,YACrC,IAAI;AAAA,cACH,MAAM,SAAS,MAAM,QAAQ,SAAS,UAAU,cAAc;AAAA,gBAC7D,QACC;AAAA,gBACD,aAAa;AAAA,gBACb,QAAQ;AAAA,cACT,CAAC;AAAA,cACD,QAAO,IAAI,EAAE,OAAO,GAAG,kBAAkB;AAAA,cACxC,OAAO,OAAO;AAAA,cACf,QAAO,MAAM,EAAE,MAAM,GAAG,4BAA4B;AAAA;AAAA;AAAA,QAGvD;AAAA,QACA;AAAA,UACC,MAAM;AAAA,UACN,IAAI,OAAO,YAA2B;AAAA,YACrC,IAAI;AAAA,cACH,MAAM,SAAS,MAAM,QAAQ,SAAS,UAAU,cAAc;AAAA,gBAC7D,QACC;AAAA,gBACD,aAAa;AAAA,gBACb,QAAQ;AAAA,cACT,CAAC;AAAA,cACD,QAAO,IAAI,EAAE,OAAO,GAAG,kBAAkB;AAAA,cACxC,OAAO,OAAO;AAAA,cACf,QAAO,MAAM,EAAE,MAAM,GAAG,4BAA4B;AAAA;AAAA;AAAA,QAGvD;AAAA,MACD;AAAA,IACD;AAAA,EACD;AACD;",
13
+ "debugId": "1B448803DF37FD5464756E2164756E21",
14
+ "names": []
15
+ }
@@ -0,0 +1,2 @@
1
+ export * from '../index';
2
+ export { default } from '../index';
@@ -0,0 +1,2 @@
1
+ export * from '../index';
2
+ export { default } from '../index';
@@ -0,0 +1,98 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropNames = Object.getOwnPropertyNames;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ function __accessProp(key) {
6
+ return this[key];
7
+ }
8
+ var __toCommonJS = (from) => {
9
+ var entry = (__moduleCache ??= new WeakMap).get(from), desc;
10
+ if (entry)
11
+ return entry;
12
+ entry = __defProp({}, "__esModule", { value: true });
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (var key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(entry, key))
16
+ __defProp(entry, key, {
17
+ get: __accessProp.bind(from, key),
18
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
19
+ });
20
+ }
21
+ __moduleCache.set(from, entry);
22
+ return entry;
23
+ };
24
+ var __moduleCache;
25
+ var __returnValue = (v) => v;
26
+ function __exportSetter(name, newValue) {
27
+ this[name] = __returnValue.bind(null, newValue);
28
+ }
29
+ var __export = (target, all) => {
30
+ for (var name in all)
31
+ __defProp(target, name, {
32
+ get: all[name],
33
+ enumerable: true,
34
+ configurable: true,
35
+ set: __exportSetter.bind(all, name)
36
+ });
37
+ };
38
+
39
+ // index.ts
40
+ var exports_typescript = {};
41
+ __export(exports_typescript, {
42
+ ollamaPlugin: () => import_plugin.ollamaPlugin,
43
+ getSmallModel: () => getSmallModel,
44
+ getSetting: () => getSetting,
45
+ getLargeModel: () => getLargeModel,
46
+ getEmbeddingModel: () => getEmbeddingModel,
47
+ getBaseURL: () => getBaseURL,
48
+ getApiBase: () => getApiBase,
49
+ default: () => import_plugin.ollamaPlugin,
50
+ DEFAULT_SMALL_MODEL: () => DEFAULT_SMALL_MODEL,
51
+ DEFAULT_OLLAMA_URL: () => DEFAULT_OLLAMA_URL,
52
+ DEFAULT_LARGE_MODEL: () => DEFAULT_LARGE_MODEL,
53
+ DEFAULT_EMBEDDING_MODEL: () => DEFAULT_EMBEDDING_MODEL
54
+ });
55
+ module.exports = __toCommonJS(exports_typescript);
56
+
57
+ // utils/config.ts
58
+ var DEFAULT_OLLAMA_URL = "http://localhost:11434";
59
+ var DEFAULT_SMALL_MODEL = "gemma3:latest";
60
+ var DEFAULT_LARGE_MODEL = "gemma3:latest";
61
+ var DEFAULT_EMBEDDING_MODEL = "nomic-embed-text:latest";
62
+ function getEnvValue(key) {
63
+ if (typeof process === "undefined" || !process.env) {
64
+ return;
65
+ }
66
+ const value = process.env[key];
67
+ return value === undefined ? undefined : String(value);
68
+ }
69
+ function getSetting(runtime, key, defaultValue) {
70
+ const value = runtime.getSetting(key);
71
+ if (value !== undefined && value !== null) {
72
+ return String(value);
73
+ }
74
+ return getEnvValue(key) ?? defaultValue;
75
+ }
76
+ function getBaseURL(runtime) {
77
+ const apiEndpoint = getSetting(runtime, "OLLAMA_API_ENDPOINT") || getSetting(runtime, "OLLAMA_API_URL") || DEFAULT_OLLAMA_URL;
78
+ if (!apiEndpoint.endsWith("/api")) {
79
+ return apiEndpoint.endsWith("/") ? `${apiEndpoint}api` : `${apiEndpoint}/api`;
80
+ }
81
+ return apiEndpoint;
82
+ }
83
+ function getApiBase(runtime) {
84
+ const baseURL = getBaseURL(runtime);
85
+ return baseURL.endsWith("/api") ? baseURL.slice(0, -4) : baseURL;
86
+ }
87
+ function getSmallModel(runtime) {
88
+ return getSetting(runtime, "OLLAMA_SMALL_MODEL") || getSetting(runtime, "SMALL_MODEL") || DEFAULT_SMALL_MODEL;
89
+ }
90
+ function getLargeModel(runtime) {
91
+ return getSetting(runtime, "OLLAMA_LARGE_MODEL") || getSetting(runtime, "LARGE_MODEL") || DEFAULT_LARGE_MODEL;
92
+ }
93
+ function getEmbeddingModel(runtime) {
94
+ return getSetting(runtime, "OLLAMA_EMBEDDING_MODEL") || DEFAULT_EMBEDDING_MODEL;
95
+ }
96
+
97
+ //# debugId=5FB0BA3DB006FDFB64756E2164756E21
98
+ //# sourceMappingURL=index.node.cjs.map
@@ -0,0 +1,10 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../utils/config.ts"],
4
+ "sourcesContent": [
5
+ "type SettingsProvider = {\n\tgetSetting: (key: string) => string | number | boolean | null;\n};\n\nexport const DEFAULT_OLLAMA_URL = \"http://localhost:11434\";\nexport const DEFAULT_SMALL_MODEL = \"gemma3:latest\";\nexport const DEFAULT_LARGE_MODEL = \"gemma3:latest\";\nexport const DEFAULT_EMBEDDING_MODEL = \"nomic-embed-text:latest\";\n\nfunction getEnvValue(key: string): string | undefined {\n\tif (typeof process === \"undefined\" || !process.env) {\n\t\treturn undefined;\n\t}\n\tconst value = process.env[key];\n\treturn value === undefined ? undefined : String(value);\n}\n\nexport function getSetting(\n\truntime: SettingsProvider,\n\tkey: string,\n\tdefaultValue?: string,\n): string | undefined {\n\tconst value = runtime.getSetting(key);\n\tif (value !== undefined && value !== null) {\n\t\treturn String(value);\n\t}\n\treturn getEnvValue(key) ?? defaultValue;\n}\n\nexport function getBaseURL(runtime: SettingsProvider): string {\n\tconst apiEndpoint =\n\t\tgetSetting(runtime, \"OLLAMA_API_ENDPOINT\") ||\n\t\tgetSetting(runtime, \"OLLAMA_API_URL\") ||\n\t\tDEFAULT_OLLAMA_URL;\n\n\tif (!apiEndpoint.endsWith(\"/api\")) {\n\t\treturn apiEndpoint.endsWith(\"/\")\n\t\t\t? `${apiEndpoint}api`\n\t\t\t: `${apiEndpoint}/api`;\n\t}\n\treturn apiEndpoint;\n}\n\nexport function getApiBase(runtime: SettingsProvider): string {\n\tconst baseURL = getBaseURL(runtime);\n\treturn baseURL.endsWith(\"/api\") ? baseURL.slice(0, -4) : baseURL;\n}\n\nexport function getSmallModel(runtime: SettingsProvider): string {\n\treturn (\n\t\tgetSetting(runtime, \"OLLAMA_SMALL_MODEL\") ||\n\t\tgetSetting(runtime, \"SMALL_MODEL\") ||\n\t\tDEFAULT_SMALL_MODEL\n\t);\n}\n\nexport function getLargeModel(runtime: SettingsProvider): string {\n\treturn (\n\t\tgetSetting(runtime, \"OLLAMA_LARGE_MODEL\") ||\n\t\tgetSetting(runtime, \"LARGE_MODEL\") ||\n\t\tDEFAULT_LARGE_MODEL\n\t);\n}\n\nexport function getEmbeddingModel(runtime: SettingsProvider): string {\n\treturn (\n\t\tgetSetting(runtime, \"OLLAMA_EMBEDDING_MODEL\") || DEFAULT_EMBEDDING_MODEL\n\t);\n}\n"
6
+ ],
7
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIO,IAAM,qBAAqB;AAC3B,IAAM,sBAAsB;AAC5B,IAAM,sBAAsB;AAC5B,IAAM,0BAA0B;AAEvC,SAAS,WAAW,CAAC,KAAiC;AAAA,EACrD,IAAI,OAAO,YAAY,eAAe,CAAC,QAAQ,KAAK;AAAA,IACnD;AAAA,EACD;AAAA,EACA,MAAM,QAAQ,QAAQ,IAAI;AAAA,EAC1B,OAAO,UAAU,YAAY,YAAY,OAAO,KAAK;AAAA;AAG/C,SAAS,UAAU,CACzB,SACA,KACA,cACqB;AAAA,EACrB,MAAM,QAAQ,QAAQ,WAAW,GAAG;AAAA,EACpC,IAAI,UAAU,aAAa,UAAU,MAAM;AAAA,IAC1C,OAAO,OAAO,KAAK;AAAA,EACpB;AAAA,EACA,OAAO,YAAY,GAAG,KAAK;AAAA;AAGrB,SAAS,UAAU,CAAC,SAAmC;AAAA,EAC7D,MAAM,cACL,WAAW,SAAS,qBAAqB,KACzC,WAAW,SAAS,gBAAgB,KACpC;AAAA,EAED,IAAI,CAAC,YAAY,SAAS,MAAM,GAAG;AAAA,IAClC,OAAO,YAAY,SAAS,GAAG,IAC5B,GAAG,mBACH,GAAG;AAAA,EACP;AAAA,EACA,OAAO;AAAA;AAGD,SAAS,UAAU,CAAC,SAAmC;AAAA,EAC7D,MAAM,UAAU,WAAW,OAAO;AAAA,EAClC,OAAO,QAAQ,SAAS,MAAM,IAAI,QAAQ,MAAM,GAAG,EAAE,IAAI;AAAA;AAGnD,SAAS,aAAa,CAAC,SAAmC;AAAA,EAChE,OACC,WAAW,SAAS,oBAAoB,KACxC,WAAW,SAAS,aAAa,KACjC;AAAA;AAIK,SAAS,aAAa,CAAC,SAAmC;AAAA,EAChE,OACC,WAAW,SAAS,oBAAoB,KACxC,WAAW,SAAS,aAAa,KACjC;AAAA;AAIK,SAAS,iBAAiB,CAAC,SAAmC;AAAA,EACpE,OACC,WAAW,SAAS,wBAAwB,KAAK;AAAA;",
8
+ "debugId": "5FB0BA3DB006FDFB64756E2164756E21",
9
+ "names": []
10
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=build.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../build.ts"],"names":[],"mappings":""}
@@ -0,0 +1,55 @@
1
+ /**
2
+ * Auto-generated canonical action/provider/evaluator docs for plugin-ollama.
3
+ * DO NOT EDIT - Generated from prompts/specs/**.
4
+ */
5
+ export type ActionDoc = {
6
+ name: string;
7
+ description: string;
8
+ similes?: readonly string[];
9
+ parameters?: readonly unknown[];
10
+ examples?: readonly (readonly unknown[])[];
11
+ };
12
+ export type ProviderDoc = {
13
+ name: string;
14
+ description: string;
15
+ position?: number;
16
+ dynamic?: boolean;
17
+ };
18
+ export type EvaluatorDoc = {
19
+ name: string;
20
+ description: string;
21
+ similes?: readonly string[];
22
+ alwaysRun?: boolean;
23
+ examples?: readonly unknown[];
24
+ };
25
+ export declare const coreActionsSpec: {
26
+ readonly version: "1.0.0";
27
+ readonly actions: readonly [];
28
+ };
29
+ export declare const allActionsSpec: {
30
+ readonly version: "1.0.0";
31
+ readonly actions: readonly [];
32
+ };
33
+ export declare const coreProvidersSpec: {
34
+ readonly version: "1.0.0";
35
+ readonly providers: readonly [];
36
+ };
37
+ export declare const allProvidersSpec: {
38
+ readonly version: "1.0.0";
39
+ readonly providers: readonly [];
40
+ };
41
+ export declare const coreEvaluatorsSpec: {
42
+ readonly version: "1.0.0";
43
+ readonly evaluators: readonly [];
44
+ };
45
+ export declare const allEvaluatorsSpec: {
46
+ readonly version: "1.0.0";
47
+ readonly evaluators: readonly [];
48
+ };
49
+ export declare const coreActionDocs: readonly ActionDoc[];
50
+ export declare const allActionDocs: readonly ActionDoc[];
51
+ export declare const coreProviderDocs: readonly ProviderDoc[];
52
+ export declare const allProviderDocs: readonly ProviderDoc[];
53
+ export declare const coreEvaluatorDocs: readonly EvaluatorDoc[];
54
+ export declare const allEvaluatorDocs: readonly EvaluatorDoc[];
55
+ //# sourceMappingURL=specs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"specs.d.ts","sourceRoot":"","sources":["../../../../generated/specs/specs.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,MAAM,SAAS,GAAG;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC5B,UAAU,CAAC,EAAE,SAAS,OAAO,EAAE,CAAC;IAChC,QAAQ,CAAC,EAAE,SAAS,CAAC,SAAS,OAAO,EAAE,CAAC,EAAE,CAAC;CAC3C,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,OAAO,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC5B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE,SAAS,OAAO,EAAE,CAAC;CAC9B,CAAC;AAEF,eAAO,MAAM,eAAe;;;CAGlB,CAAC;AACX,eAAO,MAAM,cAAc;;;CAGjB,CAAC;AACX,eAAO,MAAM,iBAAiB;;;CAGpB,CAAC;AACX,eAAO,MAAM,gBAAgB;;;CAGnB,CAAC;AACX,eAAO,MAAM,kBAAkB;;;CAGrB,CAAC;AACX,eAAO,MAAM,iBAAiB;;;CAGpB,CAAC;AAEX,eAAO,MAAM,cAAc,EAAE,SAAS,SAAS,EAA4B,CAAC;AAC5E,eAAO,MAAM,aAAa,EAAE,SAAS,SAAS,EAA2B,CAAC;AAC1E,eAAO,MAAM,gBAAgB,EAAE,SAAS,WAAW,EACvB,CAAC;AAC7B,eAAO,MAAM,eAAe,EAAE,SAAS,WAAW,EACvB,CAAC;AAC5B,eAAO,MAAM,iBAAiB,EAAE,SAAS,YAAY,EACvB,CAAC;AAC/B,eAAO,MAAM,gBAAgB,EAAE,SAAS,YAAY,EACvB,CAAC"}
@@ -0,0 +1,3 @@
1
+ export * from "./index";
2
+ export { default } from "./index";
3
+ //# sourceMappingURL=index.browser.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.browser.d.ts","sourceRoot":"","sources":["../../index.browser.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from '../index';
2
+ export { default } from '../index';
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,YAAY,IAAI,OAAO,EAAE,MAAM,UAAU,CAAC;AACjE,cAAc,SAAS,CAAC;AACxB,cAAc,gBAAgB,CAAC"}
@@ -0,0 +1,56 @@
1
+ // utils/config.ts
2
+ var DEFAULT_OLLAMA_URL = "http://localhost:11434";
3
+ var DEFAULT_SMALL_MODEL = "gemma3:latest";
4
+ var DEFAULT_LARGE_MODEL = "gemma3:latest";
5
+ var DEFAULT_EMBEDDING_MODEL = "nomic-embed-text:latest";
6
+ function getEnvValue(key) {
7
+ if (typeof process === "undefined" || !process.env) {
8
+ return;
9
+ }
10
+ const value = process.env[key];
11
+ return value === undefined ? undefined : String(value);
12
+ }
13
+ function getSetting(runtime, key, defaultValue) {
14
+ const value = runtime.getSetting(key);
15
+ if (value !== undefined && value !== null) {
16
+ return String(value);
17
+ }
18
+ return getEnvValue(key) ?? defaultValue;
19
+ }
20
+ function getBaseURL(runtime) {
21
+ const apiEndpoint = getSetting(runtime, "OLLAMA_API_ENDPOINT") || getSetting(runtime, "OLLAMA_API_URL") || DEFAULT_OLLAMA_URL;
22
+ if (!apiEndpoint.endsWith("/api")) {
23
+ return apiEndpoint.endsWith("/") ? `${apiEndpoint}api` : `${apiEndpoint}/api`;
24
+ }
25
+ return apiEndpoint;
26
+ }
27
+ function getApiBase(runtime) {
28
+ const baseURL = getBaseURL(runtime);
29
+ return baseURL.endsWith("/api") ? baseURL.slice(0, -4) : baseURL;
30
+ }
31
+ function getSmallModel(runtime) {
32
+ return getSetting(runtime, "OLLAMA_SMALL_MODEL") || getSetting(runtime, "SMALL_MODEL") || DEFAULT_SMALL_MODEL;
33
+ }
34
+ function getLargeModel(runtime) {
35
+ return getSetting(runtime, "OLLAMA_LARGE_MODEL") || getSetting(runtime, "LARGE_MODEL") || DEFAULT_LARGE_MODEL;
36
+ }
37
+ function getEmbeddingModel(runtime) {
38
+ return getSetting(runtime, "OLLAMA_EMBEDDING_MODEL") || DEFAULT_EMBEDDING_MODEL;
39
+ }
40
+ export {
41
+ ollamaPlugin,
42
+ getSmallModel,
43
+ getSetting,
44
+ getLargeModel,
45
+ getEmbeddingModel,
46
+ getBaseURL,
47
+ getApiBase,
48
+ ollamaPlugin2 as default,
49
+ DEFAULT_SMALL_MODEL,
50
+ DEFAULT_OLLAMA_URL,
51
+ DEFAULT_LARGE_MODEL,
52
+ DEFAULT_EMBEDDING_MODEL
53
+ };
54
+
55
+ //# debugId=6582A0D5713070FA64756E2164756E21
56
+ //# sourceMappingURL=index.node.js.map
@@ -0,0 +1,10 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../utils/config.ts"],
4
+ "sourcesContent": [
5
+ "type SettingsProvider = {\n\tgetSetting: (key: string) => string | number | boolean | null;\n};\n\nexport const DEFAULT_OLLAMA_URL = \"http://localhost:11434\";\nexport const DEFAULT_SMALL_MODEL = \"gemma3:latest\";\nexport const DEFAULT_LARGE_MODEL = \"gemma3:latest\";\nexport const DEFAULT_EMBEDDING_MODEL = \"nomic-embed-text:latest\";\n\nfunction getEnvValue(key: string): string | undefined {\n\tif (typeof process === \"undefined\" || !process.env) {\n\t\treturn undefined;\n\t}\n\tconst value = process.env[key];\n\treturn value === undefined ? undefined : String(value);\n}\n\nexport function getSetting(\n\truntime: SettingsProvider,\n\tkey: string,\n\tdefaultValue?: string,\n): string | undefined {\n\tconst value = runtime.getSetting(key);\n\tif (value !== undefined && value !== null) {\n\t\treturn String(value);\n\t}\n\treturn getEnvValue(key) ?? defaultValue;\n}\n\nexport function getBaseURL(runtime: SettingsProvider): string {\n\tconst apiEndpoint =\n\t\tgetSetting(runtime, \"OLLAMA_API_ENDPOINT\") ||\n\t\tgetSetting(runtime, \"OLLAMA_API_URL\") ||\n\t\tDEFAULT_OLLAMA_URL;\n\n\tif (!apiEndpoint.endsWith(\"/api\")) {\n\t\treturn apiEndpoint.endsWith(\"/\")\n\t\t\t? `${apiEndpoint}api`\n\t\t\t: `${apiEndpoint}/api`;\n\t}\n\treturn apiEndpoint;\n}\n\nexport function getApiBase(runtime: SettingsProvider): string {\n\tconst baseURL = getBaseURL(runtime);\n\treturn baseURL.endsWith(\"/api\") ? baseURL.slice(0, -4) : baseURL;\n}\n\nexport function getSmallModel(runtime: SettingsProvider): string {\n\treturn (\n\t\tgetSetting(runtime, \"OLLAMA_SMALL_MODEL\") ||\n\t\tgetSetting(runtime, \"SMALL_MODEL\") ||\n\t\tDEFAULT_SMALL_MODEL\n\t);\n}\n\nexport function getLargeModel(runtime: SettingsProvider): string {\n\treturn (\n\t\tgetSetting(runtime, \"OLLAMA_LARGE_MODEL\") ||\n\t\tgetSetting(runtime, \"LARGE_MODEL\") ||\n\t\tDEFAULT_LARGE_MODEL\n\t);\n}\n\nexport function getEmbeddingModel(runtime: SettingsProvider): string {\n\treturn (\n\t\tgetSetting(runtime, \"OLLAMA_EMBEDDING_MODEL\") || DEFAULT_EMBEDDING_MODEL\n\t);\n}\n"
6
+ ],
7
+ "mappings": ";AAIO,IAAM,qBAAqB;AAC3B,IAAM,sBAAsB;AAC5B,IAAM,sBAAsB;AAC5B,IAAM,0BAA0B;AAEvC,SAAS,WAAW,CAAC,KAAiC;AAAA,EACrD,IAAI,OAAO,YAAY,eAAe,CAAC,QAAQ,KAAK;AAAA,IACnD;AAAA,EACD;AAAA,EACA,MAAM,QAAQ,QAAQ,IAAI;AAAA,EAC1B,OAAO,UAAU,YAAY,YAAY,OAAO,KAAK;AAAA;AAG/C,SAAS,UAAU,CACzB,SACA,KACA,cACqB;AAAA,EACrB,MAAM,QAAQ,QAAQ,WAAW,GAAG;AAAA,EACpC,IAAI,UAAU,aAAa,UAAU,MAAM;AAAA,IAC1C,OAAO,OAAO,KAAK;AAAA,EACpB;AAAA,EACA,OAAO,YAAY,GAAG,KAAK;AAAA;AAGrB,SAAS,UAAU,CAAC,SAAmC;AAAA,EAC7D,MAAM,cACL,WAAW,SAAS,qBAAqB,KACzC,WAAW,SAAS,gBAAgB,KACpC;AAAA,EAED,IAAI,CAAC,YAAY,SAAS,MAAM,GAAG;AAAA,IAClC,OAAO,YAAY,SAAS,GAAG,IAC5B,GAAG,mBACH,GAAG;AAAA,EACP;AAAA,EACA,OAAO;AAAA;AAGD,SAAS,UAAU,CAAC,SAAmC;AAAA,EAC7D,MAAM,UAAU,WAAW,OAAO;AAAA,EAClC,OAAO,QAAQ,SAAS,MAAM,IAAI,QAAQ,MAAM,GAAG,EAAE,IAAI;AAAA;AAGnD,SAAS,aAAa,CAAC,SAAmC;AAAA,EAChE,OACC,WAAW,SAAS,oBAAoB,KACxC,WAAW,SAAS,aAAa,KACjC;AAAA;AAIK,SAAS,aAAa,CAAC,SAAmC;AAAA,EAChE,OACC,WAAW,SAAS,oBAAoB,KACxC,WAAW,SAAS,aAAa,KACjC;AAAA;AAIK,SAAS,iBAAiB,CAAC,SAAmC;AAAA,EACpE,OACC,WAAW,SAAS,wBAAwB,KAAK;AAAA;",
8
+ "debugId": "6582A0D5713070FA64756E2164756E21",
9
+ "names": []
10
+ }
@@ -0,0 +1,2 @@
1
+ export declare function ensureModelAvailable(model: string, providedBaseURL?: string, customFetch?: typeof fetch | null): Promise<void>;
2
+ //# sourceMappingURL=availability.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"availability.d.ts","sourceRoot":"","sources":["../../../models/availability.ts"],"names":[],"mappings":"AAEA,wBAAsB,oBAAoB,CACzC,KAAK,EAAE,MAAM,EACb,eAAe,CAAC,EAAE,MAAM,EACxB,WAAW,CAAC,EAAE,OAAO,KAAK,GAAG,IAAI,GAC/B,OAAO,CAAC,IAAI,CAAC,CAgCf"}
@@ -0,0 +1,3 @@
1
+ import type { IAgentRuntime, TextEmbeddingParams } from "@elizaos/core";
2
+ export declare function handleTextEmbedding(runtime: IAgentRuntime, params: TextEmbeddingParams | string | null): Promise<number[]>;
3
+ //# sourceMappingURL=embedding.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"embedding.d.ts","sourceRoot":"","sources":["../../../models/embedding.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAQxE,wBAAsB,mBAAmB,CACxC,OAAO,EAAE,aAAa,EACtB,MAAM,EAAE,mBAAmB,GAAG,MAAM,GAAG,IAAI,GACzC,OAAO,CAAC,MAAM,EAAE,CAAC,CA+CnB"}
@@ -0,0 +1,5 @@
1
+ export { ensureModelAvailable } from "./availability";
2
+ export { handleTextEmbedding } from "./embedding";
3
+ export { handleObjectLarge, handleObjectSmall } from "./object";
4
+ export { handleTextLarge, handleTextSmall } from "./text";
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../models/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { IAgentRuntime, ObjectGenerationParams } from "@elizaos/core";
2
+ export declare function handleObjectSmall(runtime: IAgentRuntime, params: ObjectGenerationParams): Promise<Record<string, string | number | boolean | null>>;
3
+ export declare function handleObjectLarge(runtime: IAgentRuntime, params: ObjectGenerationParams): Promise<Record<string, string | number | boolean | null>>;
4
+ //# sourceMappingURL=object.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"object.d.ts","sourceRoot":"","sources":["../../../models/object.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AA6B3E,wBAAsB,iBAAiB,CACtC,OAAO,EAAE,aAAa,EACtB,MAAM,EAAE,sBAAsB,GAC5B,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,CAAC,CAAC,CAkB3D;AAED,wBAAsB,iBAAiB,CACtC,OAAO,EAAE,aAAa,EACtB,MAAM,EAAE,sBAAsB,GAC5B,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,CAAC,CAAC,CAkB3D"}
@@ -0,0 +1,4 @@
1
+ import type { GenerateTextParams, IAgentRuntime } from "@elizaos/core";
2
+ export declare function handleTextSmall(runtime: IAgentRuntime, { prompt, stopSequences }: GenerateTextParams): Promise<string>;
3
+ export declare function handleTextLarge(runtime: IAgentRuntime, { prompt, stopSequences, maxTokens, temperature, frequencyPenalty, presencePenalty, }: GenerateTextParams): Promise<string>;
4
+ //# sourceMappingURL=text.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"text.d.ts","sourceRoot":"","sources":["../../../models/text.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAyCvE,wBAAsB,eAAe,CACpC,OAAO,EAAE,aAAa,EACtB,EAAE,MAAM,EAAE,aAAkB,EAAE,EAAE,kBAAkB,GAChD,OAAO,CAAC,MAAM,CAAC,CA+BjB;AAED,wBAAsB,eAAe,CACpC,OAAO,EAAE,aAAa,EACtB,EACC,MAAM,EACN,aAAkB,EAClB,SAAgB,EAChB,WAAiB,EACjB,gBAAsB,EACtB,eAAqB,GACrB,EAAE,kBAAkB,GACnB,OAAO,CAAC,MAAM,CAAC,CAyBjB"}
@@ -0,0 +1,3 @@
1
+ import type { Plugin } from "@elizaos/core";
2
+ export declare const ollamaPlugin: Plugin;
3
+ //# sourceMappingURL=plugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAIX,MAAM,EAEN,MAAM,eAAe,CAAC;AAwBvB,eAAO,MAAM,YAAY,EAAE,MAuL1B,CAAC"}
@@ -0,0 +1,47 @@
1
+ export interface OllamaConfig {
2
+ baseUrl: string;
3
+ smallModel: string;
4
+ largeModel: string;
5
+ embeddingModel: string;
6
+ timeoutMs: number;
7
+ }
8
+ export interface TextGenerationParams {
9
+ prompt: string;
10
+ system?: string;
11
+ temperature?: number;
12
+ maxTokens?: number;
13
+ frequencyPenalty?: number;
14
+ presencePenalty?: number;
15
+ stopSequences?: string[];
16
+ }
17
+ export interface TextGenerationResponse {
18
+ text: string;
19
+ model: string;
20
+ }
21
+ export interface ObjectGenerationParams {
22
+ prompt: string;
23
+ system?: string;
24
+ temperature?: number;
25
+ schema?: Record<string, string | number | boolean | null>;
26
+ maxTokens?: number;
27
+ }
28
+ export interface ObjectGenerationResponse {
29
+ object: Record<string, string | number | boolean | null>;
30
+ model: string;
31
+ }
32
+ export interface EmbeddingParams {
33
+ text: string;
34
+ }
35
+ export interface EmbeddingResponse {
36
+ embedding: number[];
37
+ model: string;
38
+ }
39
+ export interface OllamaModelInfo {
40
+ name: string;
41
+ size: number;
42
+ modified_at: string;
43
+ }
44
+ export interface OllamaTagsResponse {
45
+ models: OllamaModelInfo[];
46
+ }
47
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../types/index.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,YAAY;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc,EAAE,MAAM,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,oBAAoB;IACpC,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;CACzB;AAED,MAAM,WAAW,sBAAsB;IACtC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,sBAAsB;IACtC,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,CAAC,CAAC;IAC1D,SAAS,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,wBAAwB;IACxC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,CAAC,CAAC;IACzD,KAAK,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,eAAe;IAC/B,IAAI,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,iBAAiB;IACjC,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,eAAe;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,kBAAkB;IAClC,MAAM,EAAE,eAAe,EAAE,CAAC;CAC1B"}
@@ -0,0 +1,15 @@
1
+ type SettingsProvider = {
2
+ getSetting: (key: string) => string | number | boolean | null;
3
+ };
4
+ export declare const DEFAULT_OLLAMA_URL = "http://localhost:11434";
5
+ export declare const DEFAULT_SMALL_MODEL = "gemma3:latest";
6
+ export declare const DEFAULT_LARGE_MODEL = "gemma3:latest";
7
+ export declare const DEFAULT_EMBEDDING_MODEL = "nomic-embed-text:latest";
8
+ export declare function getSetting(runtime: SettingsProvider, key: string, defaultValue?: string): string | undefined;
9
+ export declare function getBaseURL(runtime: SettingsProvider): string;
10
+ export declare function getApiBase(runtime: SettingsProvider): string;
11
+ export declare function getSmallModel(runtime: SettingsProvider): string;
12
+ export declare function getLargeModel(runtime: SettingsProvider): string;
13
+ export declare function getEmbeddingModel(runtime: SettingsProvider): string;
14
+ export {};
15
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../utils/config.ts"],"names":[],"mappings":"AAAA,KAAK,gBAAgB,GAAG;IACvB,UAAU,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,CAAC;CAC9D,CAAC;AAEF,eAAO,MAAM,kBAAkB,2BAA2B,CAAC;AAC3D,eAAO,MAAM,mBAAmB,kBAAkB,CAAC;AACnD,eAAO,MAAM,mBAAmB,kBAAkB,CAAC;AACnD,eAAO,MAAM,uBAAuB,4BAA4B,CAAC;AAUjE,wBAAgB,UAAU,CACzB,OAAO,EAAE,gBAAgB,EACzB,GAAG,EAAE,MAAM,EACX,YAAY,CAAC,EAAE,MAAM,GACnB,MAAM,GAAG,SAAS,CAMpB;AAED,wBAAgB,UAAU,CAAC,OAAO,EAAE,gBAAgB,GAAG,MAAM,CAY5D;AAED,wBAAgB,UAAU,CAAC,OAAO,EAAE,gBAAgB,GAAG,MAAM,CAG5D;AAED,wBAAgB,aAAa,CAAC,OAAO,EAAE,gBAAgB,GAAG,MAAM,CAM/D;AAED,wBAAgB,aAAa,CAAC,OAAO,EAAE,gBAAgB,GAAG,MAAM,CAM/D;AAED,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,gBAAgB,GAAG,MAAM,CAInE"}
@@ -0,0 +1,2 @@
1
+ export * from "./config";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC"}
package/package.json CHANGED
@@ -1,136 +1,136 @@
1
1
  {
2
- "name": "@elizaos/plugin-ollama",
3
- "version": "2.0.0-alpha.11",
4
- "type": "module",
5
- "main": "dist/node/index.node.js",
6
- "module": "dist/node/index.node.js",
7
- "types": "dist/node/index.d.ts",
8
- "repository": {
9
- "type": "git",
10
- "url": "git+https://github.com/elizaos-plugins/plugin-ollama.git"
11
- },
12
- "exports": {
13
- "./package.json": "./package.json",
14
- ".": {
15
- "types": "./dist/node/index.d.ts",
16
- "browser": {
17
- "types": "./dist/browser/index.d.ts",
18
- "import": "./dist/browser/index.browser.js",
19
- "default": "./dist/browser/index.browser.js"
20
- },
21
- "node": {
22
- "types": "./dist/node/index.d.ts",
23
- "import": "./dist/node/index.node.js",
24
- "default": "./dist/node/index.node.js"
25
- },
26
- "bun": {
27
- "types": "./dist/node/index.d.ts",
28
- "default": "./dist/node/index.node.js"
29
- },
30
- "require": "./dist/cjs/index.node.cjs",
31
- "default": "./dist/node/index.node.js"
32
- }
33
- },
34
- "files": [
35
- "dist"
36
- ],
37
- "sideEffects": false,
38
- "dependencies": {
39
- "@ai-sdk/ui-utils": "^1.2.8",
40
- "ai": "^4.3.9",
41
- "js-tiktoken": "^1.0.18",
42
- "ollama-ai-provider": "^1.2.0"
43
- },
44
- "devDependencies": {
45
- "@biomejs/biome": "2.4.2",
46
- "@types/node": "^25.0.3",
47
- "typescript": "^5.9.3",
48
- "@types/bun": "^1.3.11",
49
- "@elizaos/core": "2.0.0-alpha.98",
50
- "vitest": "^4.0.0"
51
- },
52
- "scripts": {
53
- "dev": "bun run build.ts --watch",
54
- "lint": "bunx @biomejs/biome check --write --unsafe .",
55
- "clean": "rm -rf dist .turbo node_modules .turbo-tsconfig.json tsconfig.tsbuildinfo",
56
- "format": "bunx @biomejs/biome format --write .",
57
- "format:check": "bunx @biomejs/biome format .",
58
- "typecheck": "tsc --noEmit --noCheck -p tsconfig.json",
59
- "test": "vitest run __tests__/ --passWithNoTests",
60
- "test:unit": "vitest run __tests__/",
61
- "lint:check": "bunx @biomejs/biome check .",
62
- "build": "bun run build.ts",
63
- "build:ts": "bun run build.ts"
64
- },
65
- "publishConfig": {
66
- "access": "public"
67
- },
68
- "agentConfig": {
69
- "pluginType": "elizaos:plugin:1.0.0",
70
- "pluginParameters": {
71
- "OLLAMA_API_ENDPOINT": {
72
- "type": "string",
73
- "description": "Base URL for the Ollama API. The plugin will strip this to the domain part and append the necessary API paths.",
74
- "required": true,
75
- "default": "http://localhost:11434/api",
76
- "sensitive": false
77
- },
78
- "OLLAMA_SMALL_MODEL": {
79
- "type": "string",
80
- "description": "Name or tag of the small-sized Ollama model to use for text and object generation.",
81
- "required": false,
82
- "default": "gemma3:latest",
83
- "sensitive": false
84
- },
85
- "OLLAMA_MEDIUM_MODEL": {
86
- "type": "string",
87
- "description": "Name or tag of the medium-sized Ollama model (defined in config but not currently used).",
88
- "required": false,
89
- "sensitive": false
90
- },
91
- "OLLAMA_LARGE_MODEL": {
92
- "type": "string",
93
- "description": "Name or tag of the large-sized Ollama model to use for text and object generation.",
94
- "required": false,
95
- "default": "gemma3:latest",
96
- "sensitive": false
97
- },
98
- "OLLAMA_EMBEDDING_MODEL": {
99
- "type": "string",
100
- "description": "Name or tag of the Ollama model used to generate text embeddings.",
101
- "required": false,
102
- "default": "nomic-embed-text:latest",
103
- "sensitive": false
104
- },
105
- "SMALL_MODEL": {
106
- "type": "string",
107
- "description": "Fallback environment variable for specifying a small model if OLLAMA_SMALL_MODEL is not set.",
108
- "required": false,
109
- "default": "gemma3:latest",
110
- "sensitive": false
111
- },
112
- "LARGE_MODEL": {
113
- "type": "string",
114
- "description": "Fallback environment variable for specifying a large model if OLLAMA_LARGE_MODEL is not set.",
115
- "required": false,
116
- "default": "gemma3:latest",
117
- "sensitive": false
118
- }
119
- }
120
- },
121
- "gitHead": "646c632924826e2b75c2304a75ee56959fe4a460",
122
- "milady": {
123
- "platforms": [
124
- "browser",
125
- "node"
126
- ],
127
- "runtime": "both",
128
- "platformDetails": {
129
- "browser": "Browser-compatible build available via exports.browser",
130
- "node": "Node.js build available via exports.node"
131
- }
132
- },
133
- "peerDependencies": {
134
- "@elizaos/core": ">=2.0.0-alpha.98 <3.0.0"
135
- }
2
+ "name": "@elizaos/plugin-ollama",
3
+ "version": "2.0.0-alpha.12",
4
+ "type": "module",
5
+ "main": "dist/node/index.node.js",
6
+ "module": "dist/node/index.node.js",
7
+ "types": "dist/node/index.d.ts",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/elizaos-plugins/plugin-ollama.git"
11
+ },
12
+ "exports": {
13
+ "./package.json": "./package.json",
14
+ ".": {
15
+ "types": "./dist/node/index.d.ts",
16
+ "browser": {
17
+ "types": "./dist/browser/index.d.ts",
18
+ "import": "./dist/browser/index.browser.js",
19
+ "default": "./dist/browser/index.browser.js"
20
+ },
21
+ "node": {
22
+ "types": "./dist/node/index.d.ts",
23
+ "import": "./dist/node/index.node.js",
24
+ "default": "./dist/node/index.node.js"
25
+ },
26
+ "bun": {
27
+ "types": "./dist/node/index.d.ts",
28
+ "default": "./dist/node/index.node.js"
29
+ },
30
+ "require": "./dist/cjs/index.node.cjs",
31
+ "default": "./dist/node/index.node.js"
32
+ }
33
+ },
34
+ "files": [
35
+ "dist"
36
+ ],
37
+ "sideEffects": false,
38
+ "dependencies": {
39
+ "@ai-sdk/ui-utils": "^1.2.8",
40
+ "ai": "^4.3.9",
41
+ "js-tiktoken": "^1.0.18",
42
+ "ollama-ai-provider": "^1.2.0"
43
+ },
44
+ "devDependencies": {
45
+ "@biomejs/biome": "2.4.2",
46
+ "@types/node": "^25.0.3",
47
+ "typescript": "^5.9.3",
48
+ "@types/bun": "^1.3.11",
49
+ "@elizaos/core": "2.0.0-alpha.98",
50
+ "vitest": "^4.0.0"
51
+ },
52
+ "scripts": {
53
+ "dev": "bun run build.ts --watch",
54
+ "lint": "bunx @biomejs/biome check --write --unsafe .",
55
+ "clean": "rm -rf dist .turbo node_modules .turbo-tsconfig.json tsconfig.tsbuildinfo",
56
+ "format": "bunx @biomejs/biome format --write .",
57
+ "format:check": "bunx @biomejs/biome format .",
58
+ "typecheck": "tsc --noEmit --noCheck -p tsconfig.json",
59
+ "test": "vitest run __tests__/ --passWithNoTests",
60
+ "test:unit": "vitest run __tests__/",
61
+ "lint:check": "bunx @biomejs/biome check .",
62
+ "build": "bun run build.ts",
63
+ "build:ts": "bun run build.ts"
64
+ },
65
+ "publishConfig": {
66
+ "access": "public"
67
+ },
68
+ "agentConfig": {
69
+ "pluginType": "elizaos:plugin:1.0.0",
70
+ "pluginParameters": {
71
+ "OLLAMA_API_ENDPOINT": {
72
+ "type": "string",
73
+ "description": "Base URL for the Ollama API. The plugin will strip this to the domain part and append the necessary API paths.",
74
+ "required": true,
75
+ "default": "http://localhost:11434/api",
76
+ "sensitive": false
77
+ },
78
+ "OLLAMA_SMALL_MODEL": {
79
+ "type": "string",
80
+ "description": "Name or tag of the small-sized Ollama model to use for text and object generation.",
81
+ "required": false,
82
+ "default": "gemma3:latest",
83
+ "sensitive": false
84
+ },
85
+ "OLLAMA_MEDIUM_MODEL": {
86
+ "type": "string",
87
+ "description": "Name or tag of the medium-sized Ollama model (defined in config but not currently used).",
88
+ "required": false,
89
+ "sensitive": false
90
+ },
91
+ "OLLAMA_LARGE_MODEL": {
92
+ "type": "string",
93
+ "description": "Name or tag of the large-sized Ollama model to use for text and object generation.",
94
+ "required": false,
95
+ "default": "gemma3:latest",
96
+ "sensitive": false
97
+ },
98
+ "OLLAMA_EMBEDDING_MODEL": {
99
+ "type": "string",
100
+ "description": "Name or tag of the Ollama model used to generate text embeddings.",
101
+ "required": false,
102
+ "default": "nomic-embed-text:latest",
103
+ "sensitive": false
104
+ },
105
+ "SMALL_MODEL": {
106
+ "type": "string",
107
+ "description": "Fallback environment variable for specifying a small model if OLLAMA_SMALL_MODEL is not set.",
108
+ "required": false,
109
+ "default": "gemma3:latest",
110
+ "sensitive": false
111
+ },
112
+ "LARGE_MODEL": {
113
+ "type": "string",
114
+ "description": "Fallback environment variable for specifying a large model if OLLAMA_LARGE_MODEL is not set.",
115
+ "required": false,
116
+ "default": "gemma3:latest",
117
+ "sensitive": false
118
+ }
119
+ }
120
+ },
121
+ "gitHead": "646c632924826e2b75c2304a75ee56959fe4a460",
122
+ "milady": {
123
+ "platforms": [
124
+ "browser",
125
+ "node"
126
+ ],
127
+ "runtime": "both",
128
+ "platformDetails": {
129
+ "browser": "Browser-compatible build available via exports.browser",
130
+ "node": "Node.js build available via exports.node"
131
+ }
132
+ },
133
+ "peerDependencies": {
134
+ "@elizaos/core": ">=2.0.0-alpha.98 <3.0.0"
135
+ }
136
136
  }