@elizaos/plugin-eliza-classic 2.0.0-alpha.7 → 2.0.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.browser.d.ts +2 -2
- package/dist/index.browser.js +88 -1
- package/dist/index.browser.js.map +1 -1
- package/dist/index.d.ts +8 -5
- package/dist/index.js +88 -4
- package/dist/index.js.map +1 -1
- package/package.json +34 -50
- package/dist/actions/generateResponse.d.ts +0 -4
- package/dist/actions/generateResponse.d.ts.map +0 -1
- package/dist/actions/generateResponse.js +0 -50
- package/dist/actions/generateResponse.js.map +0 -1
- package/dist/actions/index.d.ts +0 -2
- package/dist/actions/index.d.ts.map +0 -1
- package/dist/actions/index.js +0 -2
- package/dist/actions/index.js.map +0 -1
- package/dist/browser/index.browser.js +0 -1382
- package/dist/browser/index.browser.js.map +0 -15
- package/dist/build.d.ts +0 -2
- package/dist/build.d.ts.map +0 -1
- package/dist/build.js +0 -60
- package/dist/build.js.map +0 -1
- package/dist/cjs/index.node.cjs +0 -1413
- package/dist/cjs/index.node.cjs.map +0 -15
- package/dist/generated/specs/spec-helpers.d.ts +0 -49
- package/dist/generated/specs/spec-helpers.d.ts.map +0 -1
- package/dist/generated/specs/spec-helpers.js +0 -79
- package/dist/generated/specs/spec-helpers.js.map +0 -1
- package/dist/generated/specs/specs.d.ts +0 -73
- package/dist/generated/specs/specs.d.ts.map +0 -1
- package/dist/generated/specs/specs.js +0 -61
- package/dist/generated/specs/specs.js.map +0 -1
- package/dist/index.browser.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.node.d.ts +0 -2
- package/dist/index.node.d.ts.map +0 -1
- package/dist/index.node.js +0 -2
- package/dist/index.node.js.map +0 -1
- package/dist/models/index.d.ts +0 -2
- package/dist/models/index.d.ts.map +0 -1
- package/dist/models/index.js +0 -2
- package/dist/models/index.js.map +0 -1
- package/dist/models/text.d.ts +0 -8
- package/dist/models/text.d.ts.map +0 -1
- package/dist/models/text.js +0 -425
- package/dist/models/text.js.map +0 -1
- package/dist/node/index.node.js +0 -1382
- package/dist/node/index.node.js.map +0 -15
- package/dist/plugin.d.ts +0 -4
- package/dist/plugin.d.ts.map +0 -1
- package/dist/plugin.js +0 -91
- package/dist/plugin.js.map +0 -1
- package/dist/providers/elizaGreeting.d.ts +0 -4
- package/dist/providers/elizaGreeting.d.ts.map +0 -1
- package/dist/providers/elizaGreeting.js +0 -21
- package/dist/providers/elizaGreeting.js.map +0 -1
- package/dist/providers/index.d.ts +0 -2
- package/dist/providers/index.d.ts.map +0 -1
- package/dist/providers/index.js +0 -2
- package/dist/providers/index.js.map +0 -1
- package/dist/types/index.d.ts +0 -49
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/index.js +0 -6
- package/dist/types/index.js.map +0 -1
package/dist/index.browser.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export
|
|
2
|
-
|
|
1
|
+
export { default, default as elizaClassicPlugin, generateElizaResponse, getElizaGreeting, plugin } from './index.js';
|
|
2
|
+
import '@elizaos/core';
|
package/dist/index.browser.js
CHANGED
|
@@ -1,2 +1,89 @@
|
|
|
1
|
-
|
|
1
|
+
// index.ts
|
|
2
|
+
import { ModelType } from "@elizaos/core";
|
|
3
|
+
var responses = [
|
|
4
|
+
{ pattern: /\bmother\b/i, response: "Tell me more about your family." },
|
|
5
|
+
{
|
|
6
|
+
pattern: /\bfather\b/i,
|
|
7
|
+
response: "How does that make you feel about your father?"
|
|
8
|
+
},
|
|
9
|
+
{ pattern: /\bfeel\b/i, response: "Do you often feel this way?" },
|
|
10
|
+
{ pattern: /\bthink\b/i, response: "Why do you think that?" },
|
|
11
|
+
{ pattern: /\bwant\b/i, response: "What would it mean if you got that?" },
|
|
12
|
+
{
|
|
13
|
+
pattern: /\bsad\b/i,
|
|
14
|
+
response: "I'm sorry to hear you're feeling sad. Can you tell me more?"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
pattern: /\bhappy\b/i,
|
|
18
|
+
response: "That's wonderful. What's making you happy?"
|
|
19
|
+
},
|
|
20
|
+
{ pattern: /\byes\b/i, response: "You seem certain. Why is that?" },
|
|
21
|
+
{ pattern: /\bno\b/i, response: "Why not?" },
|
|
22
|
+
{
|
|
23
|
+
pattern: /\bwhy\b/i,
|
|
24
|
+
response: "That's a good question. What do you think?"
|
|
25
|
+
},
|
|
26
|
+
{ pattern: /\bhow\b/i, response: "What approach would you suggest?" },
|
|
27
|
+
{
|
|
28
|
+
pattern: /\bwhat\b/i,
|
|
29
|
+
response: "What does that question mean to you?"
|
|
30
|
+
},
|
|
31
|
+
{ pattern: /\bcan\b/i, response: "What makes you ask about that?" },
|
|
32
|
+
{ pattern: /\byou\b/i, response: "We were talking about you, not me." },
|
|
33
|
+
{ pattern: /\bI am\b/i, response: "How long have you been like that?" },
|
|
34
|
+
{ pattern: /\bI\b/i, response: "Tell me more about yourself." },
|
|
35
|
+
{ pattern: /.*/, response: "Please go on." }
|
|
36
|
+
];
|
|
37
|
+
function getElizaGreeting() {
|
|
38
|
+
return "Hello. How are you feeling today?";
|
|
39
|
+
}
|
|
40
|
+
function extractUserMessage(prompt) {
|
|
41
|
+
const match = prompt.match(/(?:User|Human|You):\s*(.+?)(?:\n|$)/i);
|
|
42
|
+
return match?.[1]?.trim() ?? prompt.trim();
|
|
43
|
+
}
|
|
44
|
+
function generateElizaResponse(input) {
|
|
45
|
+
for (const entry of responses) {
|
|
46
|
+
if (entry.pattern.test(input)) return entry.response;
|
|
47
|
+
}
|
|
48
|
+
return "Please go on.";
|
|
49
|
+
}
|
|
50
|
+
async function handleText(_runtime, params) {
|
|
51
|
+
const reply = generateElizaResponse(extractUserMessage(params.prompt ?? ""));
|
|
52
|
+
return JSON.stringify({
|
|
53
|
+
thought: "Responding with deterministic ELIZA pattern matching.",
|
|
54
|
+
actions: ["REPLY"],
|
|
55
|
+
providers: [],
|
|
56
|
+
text: reply,
|
|
57
|
+
simple: true,
|
|
58
|
+
useKnowledgeProviders: false
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
async function handleEmbedding() {
|
|
62
|
+
return Array.from({ length: 1536 }, (_, index) => index === 0 ? 1 : 0);
|
|
63
|
+
}
|
|
64
|
+
var elizaClassicPlugin = {
|
|
65
|
+
name: "eliza-classic",
|
|
66
|
+
description: "Deterministic offline ELIZA-style text responses.",
|
|
67
|
+
priority: 200,
|
|
68
|
+
models: {
|
|
69
|
+
[ModelType.TEXT_NANO]: handleText,
|
|
70
|
+
[ModelType.TEXT_LARGE]: handleText,
|
|
71
|
+
[ModelType.TEXT_MEDIUM]: handleText,
|
|
72
|
+
[ModelType.TEXT_SMALL]: handleText,
|
|
73
|
+
[ModelType.TEXT_MEGA]: handleText,
|
|
74
|
+
[ModelType.RESPONSE_HANDLER]: handleText,
|
|
75
|
+
[ModelType.ACTION_PLANNER]: handleText,
|
|
76
|
+
[ModelType.TEXT_COMPLETION]: handleText,
|
|
77
|
+
[ModelType.TEXT_EMBEDDING]: handleEmbedding
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
var plugin = elizaClassicPlugin;
|
|
81
|
+
var index_default = elizaClassicPlugin;
|
|
82
|
+
export {
|
|
83
|
+
index_default as default,
|
|
84
|
+
elizaClassicPlugin,
|
|
85
|
+
generateElizaResponse,
|
|
86
|
+
getElizaGreeting,
|
|
87
|
+
plugin
|
|
88
|
+
};
|
|
2
89
|
//# sourceMappingURL=index.browser.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["../index.ts"],"sourcesContent":["import type { GenerateTextParams, IAgentRuntime, Plugin } from \"@elizaos/core\";\nimport { ModelType } from \"@elizaos/core\";\n\nconst responses = [\n { pattern: /\\bmother\\b/i, response: \"Tell me more about your family.\" },\n {\n pattern: /\\bfather\\b/i,\n response: \"How does that make you feel about your father?\",\n },\n { pattern: /\\bfeel\\b/i, response: \"Do you often feel this way?\" },\n { pattern: /\\bthink\\b/i, response: \"Why do you think that?\" },\n { pattern: /\\bwant\\b/i, response: \"What would it mean if you got that?\" },\n {\n pattern: /\\bsad\\b/i,\n response: \"I'm sorry to hear you're feeling sad. Can you tell me more?\",\n },\n {\n pattern: /\\bhappy\\b/i,\n response: \"That's wonderful. What's making you happy?\",\n },\n { pattern: /\\byes\\b/i, response: \"You seem certain. Why is that?\" },\n { pattern: /\\bno\\b/i, response: \"Why not?\" },\n {\n pattern: /\\bwhy\\b/i,\n response: \"That's a good question. What do you think?\",\n },\n { pattern: /\\bhow\\b/i, response: \"What approach would you suggest?\" },\n {\n pattern: /\\bwhat\\b/i,\n response: \"What does that question mean to you?\",\n },\n { pattern: /\\bcan\\b/i, response: \"What makes you ask about that?\" },\n { pattern: /\\byou\\b/i, response: \"We were talking about you, not me.\" },\n { pattern: /\\bI am\\b/i, response: \"How long have you been like that?\" },\n { pattern: /\\bI\\b/i, response: \"Tell me more about yourself.\" },\n { pattern: /.*/, response: \"Please go on.\" },\n] as const;\n\nexport function getElizaGreeting(): string {\n return \"Hello. How are you feeling today?\";\n}\n\nfunction extractUserMessage(prompt: string): string {\n const match = prompt.match(/(?:User|Human|You):\\s*(.+?)(?:\\n|$)/i);\n return match?.[1]?.trim() ?? prompt.trim();\n}\n\nexport function generateElizaResponse(input: string): string {\n for (const entry of responses) {\n if (entry.pattern.test(input)) return entry.response;\n }\n return \"Please go on.\";\n}\n\nasync function handleText(\n _runtime: IAgentRuntime,\n params: GenerateTextParams,\n): Promise<string> {\n const reply = generateElizaResponse(extractUserMessage(params.prompt ?? \"\"));\n return JSON.stringify({\n thought: \"Responding with deterministic ELIZA pattern matching.\",\n actions: [\"REPLY\"],\n providers: [],\n text: reply,\n simple: true,\n useKnowledgeProviders: false,\n });\n}\n\nasync function handleEmbedding(): Promise<number[]> {\n return Array.from({ length: 1536 }, (_, index) => (index === 0 ? 1 : 0));\n}\n\nexport const elizaClassicPlugin: Plugin = {\n name: \"eliza-classic\",\n description: \"Deterministic offline ELIZA-style text responses.\",\n priority: 200,\n models: {\n [ModelType.TEXT_NANO]: handleText,\n [ModelType.TEXT_LARGE]: handleText,\n [ModelType.TEXT_MEDIUM]: handleText,\n [ModelType.TEXT_SMALL]: handleText,\n [ModelType.TEXT_MEGA]: handleText,\n [ModelType.RESPONSE_HANDLER]: handleText,\n [ModelType.ACTION_PLANNER]: handleText,\n [ModelType.TEXT_COMPLETION]: handleText,\n [ModelType.TEXT_EMBEDDING]: handleEmbedding,\n },\n};\n\nexport const plugin = elizaClassicPlugin;\nexport default elizaClassicPlugin;\n"],"mappings":";AACA,SAAS,iBAAiB;AAE1B,IAAM,YAAY;AAAA,EAChB,EAAE,SAAS,eAAe,UAAU,kCAAkC;AAAA,EACtE;AAAA,IACE,SAAS;AAAA,IACT,UAAU;AAAA,EACZ;AAAA,EACA,EAAE,SAAS,aAAa,UAAU,8BAA8B;AAAA,EAChE,EAAE,SAAS,cAAc,UAAU,yBAAyB;AAAA,EAC5D,EAAE,SAAS,aAAa,UAAU,sCAAsC;AAAA,EACxE;AAAA,IACE,SAAS;AAAA,IACT,UAAU;AAAA,EACZ;AAAA,EACA;AAAA,IACE,SAAS;AAAA,IACT,UAAU;AAAA,EACZ;AAAA,EACA,EAAE,SAAS,YAAY,UAAU,iCAAiC;AAAA,EAClE,EAAE,SAAS,WAAW,UAAU,WAAW;AAAA,EAC3C;AAAA,IACE,SAAS;AAAA,IACT,UAAU;AAAA,EACZ;AAAA,EACA,EAAE,SAAS,YAAY,UAAU,mCAAmC;AAAA,EACpE;AAAA,IACE,SAAS;AAAA,IACT,UAAU;AAAA,EACZ;AAAA,EACA,EAAE,SAAS,YAAY,UAAU,iCAAiC;AAAA,EAClE,EAAE,SAAS,YAAY,UAAU,qCAAqC;AAAA,EACtE,EAAE,SAAS,aAAa,UAAU,oCAAoC;AAAA,EACtE,EAAE,SAAS,UAAU,UAAU,+BAA+B;AAAA,EAC9D,EAAE,SAAS,MAAM,UAAU,gBAAgB;AAC7C;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
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { Plugin } from '@elizaos/core';
|
|
2
|
+
|
|
3
|
+
declare function getElizaGreeting(): string;
|
|
4
|
+
declare function generateElizaResponse(input: string): string;
|
|
5
|
+
declare const elizaClassicPlugin: Plugin;
|
|
6
|
+
declare const plugin: Plugin;
|
|
7
|
+
|
|
8
|
+
export { elizaClassicPlugin as default, elizaClassicPlugin, generateElizaResponse, getElizaGreeting, plugin };
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,89 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
// index.ts
|
|
2
|
+
import { ModelType } from "@elizaos/core";
|
|
3
|
+
var responses = [
|
|
4
|
+
{ pattern: /\bmother\b/i, response: "Tell me more about your family." },
|
|
5
|
+
{
|
|
6
|
+
pattern: /\bfather\b/i,
|
|
7
|
+
response: "How does that make you feel about your father?"
|
|
8
|
+
},
|
|
9
|
+
{ pattern: /\bfeel\b/i, response: "Do you often feel this way?" },
|
|
10
|
+
{ pattern: /\bthink\b/i, response: "Why do you think that?" },
|
|
11
|
+
{ pattern: /\bwant\b/i, response: "What would it mean if you got that?" },
|
|
12
|
+
{
|
|
13
|
+
pattern: /\bsad\b/i,
|
|
14
|
+
response: "I'm sorry to hear you're feeling sad. Can you tell me more?"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
pattern: /\bhappy\b/i,
|
|
18
|
+
response: "That's wonderful. What's making you happy?"
|
|
19
|
+
},
|
|
20
|
+
{ pattern: /\byes\b/i, response: "You seem certain. Why is that?" },
|
|
21
|
+
{ pattern: /\bno\b/i, response: "Why not?" },
|
|
22
|
+
{
|
|
23
|
+
pattern: /\bwhy\b/i,
|
|
24
|
+
response: "That's a good question. What do you think?"
|
|
25
|
+
},
|
|
26
|
+
{ pattern: /\bhow\b/i, response: "What approach would you suggest?" },
|
|
27
|
+
{
|
|
28
|
+
pattern: /\bwhat\b/i,
|
|
29
|
+
response: "What does that question mean to you?"
|
|
30
|
+
},
|
|
31
|
+
{ pattern: /\bcan\b/i, response: "What makes you ask about that?" },
|
|
32
|
+
{ pattern: /\byou\b/i, response: "We were talking about you, not me." },
|
|
33
|
+
{ pattern: /\bI am\b/i, response: "How long have you been like that?" },
|
|
34
|
+
{ pattern: /\bI\b/i, response: "Tell me more about yourself." },
|
|
35
|
+
{ pattern: /.*/, response: "Please go on." }
|
|
36
|
+
];
|
|
37
|
+
function getElizaGreeting() {
|
|
38
|
+
return "Hello. How are you feeling today?";
|
|
39
|
+
}
|
|
40
|
+
function extractUserMessage(prompt) {
|
|
41
|
+
const match = prompt.match(/(?:User|Human|You):\s*(.+?)(?:\n|$)/i);
|
|
42
|
+
return match?.[1]?.trim() ?? prompt.trim();
|
|
43
|
+
}
|
|
44
|
+
function generateElizaResponse(input) {
|
|
45
|
+
for (const entry of responses) {
|
|
46
|
+
if (entry.pattern.test(input)) return entry.response;
|
|
47
|
+
}
|
|
48
|
+
return "Please go on.";
|
|
49
|
+
}
|
|
50
|
+
async function handleText(_runtime, params) {
|
|
51
|
+
const reply = generateElizaResponse(extractUserMessage(params.prompt ?? ""));
|
|
52
|
+
return JSON.stringify({
|
|
53
|
+
thought: "Responding with deterministic ELIZA pattern matching.",
|
|
54
|
+
actions: ["REPLY"],
|
|
55
|
+
providers: [],
|
|
56
|
+
text: reply,
|
|
57
|
+
simple: true,
|
|
58
|
+
useKnowledgeProviders: false
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
async function handleEmbedding() {
|
|
62
|
+
return Array.from({ length: 1536 }, (_, index) => index === 0 ? 1 : 0);
|
|
63
|
+
}
|
|
64
|
+
var elizaClassicPlugin = {
|
|
65
|
+
name: "eliza-classic",
|
|
66
|
+
description: "Deterministic offline ELIZA-style text responses.",
|
|
67
|
+
priority: 200,
|
|
68
|
+
models: {
|
|
69
|
+
[ModelType.TEXT_NANO]: handleText,
|
|
70
|
+
[ModelType.TEXT_LARGE]: handleText,
|
|
71
|
+
[ModelType.TEXT_MEDIUM]: handleText,
|
|
72
|
+
[ModelType.TEXT_SMALL]: handleText,
|
|
73
|
+
[ModelType.TEXT_MEGA]: handleText,
|
|
74
|
+
[ModelType.RESPONSE_HANDLER]: handleText,
|
|
75
|
+
[ModelType.ACTION_PLANNER]: handleText,
|
|
76
|
+
[ModelType.TEXT_COMPLETION]: handleText,
|
|
77
|
+
[ModelType.TEXT_EMBEDDING]: handleEmbedding
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
var plugin = elizaClassicPlugin;
|
|
81
|
+
var index_default = elizaClassicPlugin;
|
|
82
|
+
export {
|
|
83
|
+
index_default as default,
|
|
84
|
+
elizaClassicPlugin,
|
|
85
|
+
generateElizaResponse,
|
|
86
|
+
getElizaGreeting,
|
|
87
|
+
plugin
|
|
88
|
+
};
|
|
5
89
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["../index.ts"],"sourcesContent":["import type { GenerateTextParams, IAgentRuntime, Plugin } from \"@elizaos/core\";\nimport { ModelType } from \"@elizaos/core\";\n\nconst responses = [\n { pattern: /\\bmother\\b/i, response: \"Tell me more about your family.\" },\n {\n pattern: /\\bfather\\b/i,\n response: \"How does that make you feel about your father?\",\n },\n { pattern: /\\bfeel\\b/i, response: \"Do you often feel this way?\" },\n { pattern: /\\bthink\\b/i, response: \"Why do you think that?\" },\n { pattern: /\\bwant\\b/i, response: \"What would it mean if you got that?\" },\n {\n pattern: /\\bsad\\b/i,\n response: \"I'm sorry to hear you're feeling sad. Can you tell me more?\",\n },\n {\n pattern: /\\bhappy\\b/i,\n response: \"That's wonderful. What's making you happy?\",\n },\n { pattern: /\\byes\\b/i, response: \"You seem certain. Why is that?\" },\n { pattern: /\\bno\\b/i, response: \"Why not?\" },\n {\n pattern: /\\bwhy\\b/i,\n response: \"That's a good question. What do you think?\",\n },\n { pattern: /\\bhow\\b/i, response: \"What approach would you suggest?\" },\n {\n pattern: /\\bwhat\\b/i,\n response: \"What does that question mean to you?\",\n },\n { pattern: /\\bcan\\b/i, response: \"What makes you ask about that?\" },\n { pattern: /\\byou\\b/i, response: \"We were talking about you, not me.\" },\n { pattern: /\\bI am\\b/i, response: \"How long have you been like that?\" },\n { pattern: /\\bI\\b/i, response: \"Tell me more about yourself.\" },\n { pattern: /.*/, response: \"Please go on.\" },\n] as const;\n\nexport function getElizaGreeting(): string {\n return \"Hello. How are you feeling today?\";\n}\n\nfunction extractUserMessage(prompt: string): string {\n const match = prompt.match(/(?:User|Human|You):\\s*(.+?)(?:\\n|$)/i);\n return match?.[1]?.trim() ?? prompt.trim();\n}\n\nexport function generateElizaResponse(input: string): string {\n for (const entry of responses) {\n if (entry.pattern.test(input)) return entry.response;\n }\n return \"Please go on.\";\n}\n\nasync function handleText(\n _runtime: IAgentRuntime,\n params: GenerateTextParams,\n): Promise<string> {\n const reply = generateElizaResponse(extractUserMessage(params.prompt ?? \"\"));\n return JSON.stringify({\n thought: \"Responding with deterministic ELIZA pattern matching.\",\n actions: [\"REPLY\"],\n providers: [],\n text: reply,\n simple: true,\n useKnowledgeProviders: false,\n });\n}\n\nasync function handleEmbedding(): Promise<number[]> {\n return Array.from({ length: 1536 }, (_, index) => (index === 0 ? 1 : 0));\n}\n\nexport const elizaClassicPlugin: Plugin = {\n name: \"eliza-classic\",\n description: \"Deterministic offline ELIZA-style text responses.\",\n priority: 200,\n models: {\n [ModelType.TEXT_NANO]: handleText,\n [ModelType.TEXT_LARGE]: handleText,\n [ModelType.TEXT_MEDIUM]: handleText,\n [ModelType.TEXT_SMALL]: handleText,\n [ModelType.TEXT_MEGA]: handleText,\n [ModelType.RESPONSE_HANDLER]: handleText,\n [ModelType.ACTION_PLANNER]: handleText,\n [ModelType.TEXT_COMPLETION]: handleText,\n [ModelType.TEXT_EMBEDDING]: handleEmbedding,\n },\n};\n\nexport const plugin = eliz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,QACiB;AACjB,QAAM,QAAQ,sBAAsB,mBAAmB,OAAO,UAAU,EAAE,CAAC;AAC3E,SAAO,KAAK,UAAU;AAAA,IACpB,SAAS;AAAA,IACT,SAAS,CAAC,OAAO;AAAA,IACjB,WAAW,CAAC;AAAA,IACZ,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,uBAAuB;AAAA,EACzB,CAAC;AACH;AAEA,eAAe,kBAAqC;AAClD,SAAO,MAAM,KAAK,EAAE,QAAQ,KAAK,GAAG,CAAC,GAAG,UAAW,UAAU,IAAI,IAAI,CAAE;AACzE;AAEO,IAAM,qBAA6B;AAAA,EACxC,MAAM;AAAA,EACN,aAAa;AAAA,EACb,UAAU;AAAA,EACV,QAAQ;AAAA,IACN,CAAC,UAAU,SAAS,GAAG;AAAA,IACvB,CAAC,UAAU,UAAU,GAAG;AAAA,IACxB,CAAC,UAAU,WAAW,GAAG;AAAA,IACzB,CAAC,UAAU,UAAU,GAAG;AAAA,IACxB,CAAC,UAAU,SAAS,GAAG;AAAA,IACvB,CAAC,UAAU,gBAAgB,GAAG;AAAA,IAC9B,CAAC,UAAU,cAAc,GAAG;AAAA,IAC5B,CAAC,UAAU,eAAe,GAAG;AAAA,IAC7B,CAAC,UAAU,cAAc,GAAG;AAAA,EAC9B;AACF;AAEO,IAAM,SAAS;AACtB,IAAO,gBAAQ;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,75 +1,59 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elizaos/plugin-eliza-classic",
|
|
3
|
-
"version": "2.0.0-
|
|
3
|
+
"version": "2.0.0-beta.1",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
"
|
|
9
|
-
"
|
|
10
|
-
"repository": {
|
|
11
|
-
"type": "git",
|
|
12
|
-
"url": "git+https://github.com/elizaos-plugins/plugin-eliza-classic.git"
|
|
13
|
-
},
|
|
5
|
+
"description": "Deterministic ELIZA-style pattern matching (browser + Node); ships compiled ESM in dist/.",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"module": "./dist/index.js",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"browser": "./dist/index.browser.js",
|
|
14
10
|
"exports": {
|
|
15
11
|
"./package.json": "./package.json",
|
|
16
12
|
".": {
|
|
17
13
|
"types": "./dist/index.d.ts",
|
|
18
14
|
"browser": {
|
|
19
|
-
"types": "./dist/
|
|
20
|
-
"import": "./dist/
|
|
21
|
-
"default": "./dist/
|
|
15
|
+
"types": "./dist/index.browser.d.ts",
|
|
16
|
+
"import": "./dist/index.browser.js",
|
|
17
|
+
"default": "./dist/index.browser.js"
|
|
22
18
|
},
|
|
23
19
|
"node": {
|
|
24
|
-
"types": "./dist/
|
|
25
|
-
"import": "./dist/
|
|
26
|
-
"
|
|
27
|
-
"default": "./dist/node/index.node.js"
|
|
20
|
+
"types": "./dist/index.d.ts",
|
|
21
|
+
"import": "./dist/index.js",
|
|
22
|
+
"default": "./dist/index.js"
|
|
28
23
|
},
|
|
29
|
-
"
|
|
24
|
+
"import": "./dist/index.js",
|
|
25
|
+
"default": "./dist/index.js"
|
|
30
26
|
}
|
|
31
27
|
},
|
|
28
|
+
"sideEffects": false,
|
|
32
29
|
"files": [
|
|
33
|
-
"dist"
|
|
34
|
-
"rust"
|
|
30
|
+
"dist"
|
|
35
31
|
],
|
|
32
|
+
"scripts": {
|
|
33
|
+
"build": "tsup --config tsup.config.ts",
|
|
34
|
+
"dev": "tsup --config tsup.config.ts --watch",
|
|
35
|
+
"clean": "rm -rf dist .turbo",
|
|
36
|
+
"typecheck": "tsc --noEmit -p tsconfig.json",
|
|
37
|
+
"lint": "echo \"Lint skipped\"",
|
|
38
|
+
"lint:check": "bun run lint",
|
|
39
|
+
"test": "echo \"No tests\""
|
|
40
|
+
},
|
|
36
41
|
"dependencies": {
|
|
37
|
-
"@elizaos/core": "2.0.0-
|
|
42
|
+
"@elizaos/core": "2.0.0-beta.1"
|
|
38
43
|
},
|
|
39
44
|
"devDependencies": {
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"typescript": "^5.9.3"
|
|
45
|
+
"tsup": "8.5.1",
|
|
46
|
+
"typescript": "^6.0.3"
|
|
43
47
|
},
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
"dev": "bun --hot build.ts",
|
|
47
|
-
"lint": "bunx @biomejs/biome check --write --unsafe .",
|
|
48
|
-
"lint:check": "bunx @biomejs/biome check .",
|
|
49
|
-
"clean": "rm -rf dist .turbo node_modules",
|
|
50
|
-
"format": "bunx @biomejs/biome format --write .",
|
|
51
|
-
"format:check": "bunx @biomejs/biome format .",
|
|
52
|
-
"typecheck": "tsc --noEmit",
|
|
53
|
-
"test": "npx -y vitest@4.0.18 run --passWithNoTests",
|
|
54
|
-
"test:ts": "vitest run",
|
|
55
|
-
"build": "bun run build.ts"
|
|
48
|
+
"peerDependencies": {
|
|
49
|
+
"@elizaos/core": "2.0.0-beta.1"
|
|
56
50
|
},
|
|
57
51
|
"publishConfig": {
|
|
58
52
|
"access": "public"
|
|
59
53
|
},
|
|
60
|
-
"
|
|
61
|
-
"
|
|
62
|
-
"
|
|
63
|
-
|
|
64
|
-
"milady": {
|
|
65
|
-
"platforms": [
|
|
66
|
-
"browser",
|
|
67
|
-
"node"
|
|
68
|
-
],
|
|
69
|
-
"runtime": "both",
|
|
70
|
-
"platformDetails": {
|
|
71
|
-
"browser": "Browser-compatible build available via exports.browser",
|
|
72
|
-
"node": "Node.js build available via exports.node"
|
|
73
|
-
}
|
|
54
|
+
"repository": {
|
|
55
|
+
"type": "git",
|
|
56
|
+
"url": "git+https://github.com/elizaos/eliza.git",
|
|
57
|
+
"directory": "plugins/plugin-eliza-classic"
|
|
74
58
|
}
|
|
75
59
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"generateResponse.d.ts","sourceRoot":"","sources":["../../actions/generateResponse.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,MAAM,EAQP,MAAM,eAAe,CAAC;AAMvB,eAAO,MAAM,sBAAsB,EAAE,MAwDpC,CAAC;AAEF,eAAe,sBAAsB,CAAC"}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { ModelType } from "@elizaos/core";
|
|
2
|
-
import { requireActionSpec } from "../generated/specs/spec-helpers";
|
|
3
|
-
const spec = requireActionSpec("generate-response");
|
|
4
|
-
export const generateResponseAction = {
|
|
5
|
-
name: spec.name,
|
|
6
|
-
similes: spec.similes ? [...spec.similes] : [],
|
|
7
|
-
description: spec.description,
|
|
8
|
-
validate: async (_runtime, _message, _state) => {
|
|
9
|
-
return true;
|
|
10
|
-
},
|
|
11
|
-
handler: async (runtime, message, _state, _options, callback) => {
|
|
12
|
-
const userInput = typeof message.content === "object" && message.content !== null
|
|
13
|
-
? message.content.text || ""
|
|
14
|
-
: String(message.content || "");
|
|
15
|
-
if (!userInput.trim()) {
|
|
16
|
-
if (callback) {
|
|
17
|
-
await callback({
|
|
18
|
-
text: "I need something to respond to. What would you like to talk about?",
|
|
19
|
-
source: message.content.source,
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
return { success: false, error: "No user input provided" };
|
|
23
|
-
}
|
|
24
|
-
try {
|
|
25
|
-
const response = await runtime.useModel(ModelType.TEXT_LARGE, {
|
|
26
|
-
prompt: userInput,
|
|
27
|
-
});
|
|
28
|
-
if (callback) {
|
|
29
|
-
await callback({
|
|
30
|
-
text: response,
|
|
31
|
-
source: message.content.source,
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
return { success: true, text: response };
|
|
35
|
-
}
|
|
36
|
-
catch (error) {
|
|
37
|
-
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
38
|
-
if (callback) {
|
|
39
|
-
await callback({
|
|
40
|
-
text: "I encountered an issue. Please try again.",
|
|
41
|
-
source: message.content.source,
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
return { success: false, error: errorMessage };
|
|
45
|
-
}
|
|
46
|
-
},
|
|
47
|
-
examples: (spec.examples ?? []),
|
|
48
|
-
};
|
|
49
|
-
export default generateResponseAction;
|
|
50
|
-
//# sourceMappingURL=generateResponse.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"generateResponse.js","sourceRoot":"","sources":["../../actions/generateResponse.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AAEpE,MAAM,IAAI,GAAG,iBAAiB,CAAC,mBAAmB,CAAC,CAAC;AAEpD,MAAM,CAAC,MAAM,sBAAsB,GAAW;IAC5C,IAAI,EAAE,IAAI,CAAC,IAAI;IACf,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE;IAC9C,WAAW,EAAE,IAAI,CAAC,WAAW;IAC7B,QAAQ,EAAE,KAAK,EAAE,QAAuB,EAAE,QAAgB,EAAE,MAAc,EAAoB,EAAE;QAC9F,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,EAAE,KAAK,EACZ,OAAsB,EACtB,OAAe,EACf,MAAc,EACd,QAAyB,EACzB,QAA0B,EACS,EAAE;QACrC,MAAM,SAAS,GACb,OAAO,OAAO,CAAC,OAAO,KAAK,QAAQ,IAAI,OAAO,CAAC,OAAO,KAAK,IAAI;YAC7D,CAAC,CAAE,OAAO,CAAC,OAA6B,CAAC,IAAI,IAAI,EAAE;YACnD,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC;QAEpC,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,EAAE,CAAC;YACtB,IAAI,QAAQ,EAAE,CAAC;gBACb,MAAM,QAAQ,CAAC;oBACb,IAAI,EAAE,oEAAoE;oBAC1E,MAAM,EAAE,OAA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dist/actions/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../actions/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC"}
|