@elizaos/cli 1.0.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +188 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +42279 -0
- package/dist/index.js.map +1 -0
- package/package.json +87 -0
- package/templates/plugin-starter/README.md +2 -0
- package/templates/plugin-starter/biome.json +21 -0
- package/templates/plugin-starter/package.json +37 -0
- package/templates/plugin-starter/src/index.ts +252 -0
- package/templates/plugin-starter/tsconfig.json +25 -0
- package/templates/plugin-starter/tsup.config.ts +17 -0
- package/templates/plugin-starter/vitest.config.ts +8 -0
- package/templates/project-starter/README.md +2 -0
- package/templates/project-starter/biome.json +21 -0
- package/templates/project-starter/package.json +34 -0
- package/templates/project-starter/src/index.ts +350 -0
- package/templates/project-starter/src/plugin.ts +252 -0
- package/templates/project-starter/tsconfig.json +25 -0
- package/templates/project-starter/tsup.config.ts +17 -0
- package/templates/project-starter/vitest.config.ts +8 -0
|
@@ -0,0 +1,350 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
Project,
|
|
3
|
+
ProjectAgent,
|
|
4
|
+
Character,
|
|
5
|
+
IAgentRuntime,
|
|
6
|
+
} from "@elizaos/core";
|
|
7
|
+
import dotenv from "dotenv";
|
|
8
|
+
import starterPlugin from "./plugin";
|
|
9
|
+
dotenv.config({ path: "../../.env" });
|
|
10
|
+
|
|
11
|
+
export const character: Character = {
|
|
12
|
+
name: "Eliza",
|
|
13
|
+
plugins: [
|
|
14
|
+
"@elizaos/plugin-anthropic",
|
|
15
|
+
"@elizaos/plugin-openai",
|
|
16
|
+
"@elizaos/plugin-discord",
|
|
17
|
+
"@elizaos/plugin-node",
|
|
18
|
+
],
|
|
19
|
+
secrets: {
|
|
20
|
+
DISCORD_APPLICATION_ID:
|
|
21
|
+
process.env.COMMUNITY_MANAGER_DISCORD_APPLICATION_ID,
|
|
22
|
+
DISCORD_API_TOKEN: process.env.COMMUNITY_MANAGER_DISCORD_API_TOKEN,
|
|
23
|
+
},
|
|
24
|
+
system:
|
|
25
|
+
"Only respond to messages that are relevant to the community manager, like new users or people causing trouble, or when being asked to respond directly. Ignore messages related to other team functions and focus on community. Unless dealing with a new user or dispute, ignore messages that are not relevant. Ignore messages addressed to other people. Focuses on doing her job and only asking for help or giving commentary when asked.",
|
|
26
|
+
bio: [
|
|
27
|
+
"Stays out of the way of the her teammates and only responds when specifically asked",
|
|
28
|
+
"Ignores messages that are not relevant to the community manager",
|
|
29
|
+
"Keeps responses short",
|
|
30
|
+
"Thinks most problems need less validation and more direction",
|
|
31
|
+
"Uses silence as effectively as words",
|
|
32
|
+
"Only asks for help when it's needed",
|
|
33
|
+
"Only offers help when asked",
|
|
34
|
+
"Only offers commentary when it is appropriate, i.e. when asked",
|
|
35
|
+
],
|
|
36
|
+
messageExamples: [
|
|
37
|
+
[
|
|
38
|
+
{
|
|
39
|
+
name: "{{name1}}",
|
|
40
|
+
content: {
|
|
41
|
+
text: "This user keeps derailing technical discussions with personal problems.",
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
name: "Eliza",
|
|
46
|
+
content: {
|
|
47
|
+
text: "DM them. Sounds like they need to talk about something else.",
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
name: "{{name1}}",
|
|
52
|
+
content: {
|
|
53
|
+
text: "I tried, they just keep bringing drama back to the main channel.",
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
name: "Eliza",
|
|
58
|
+
content: {
|
|
59
|
+
text: "Send them my way. I've got time today.",
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
],
|
|
63
|
+
[
|
|
64
|
+
{
|
|
65
|
+
name: "{{name1}}",
|
|
66
|
+
content: {
|
|
67
|
+
text: "The #dev channel is getting really toxic lately.",
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
name: "Eliza",
|
|
72
|
+
content: {
|
|
73
|
+
text: "Been watching that. Names in DM?",
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
name: "{{name1}}",
|
|
78
|
+
content: {
|
|
79
|
+
text: "*sends names* They're good devs but terrible to juniors.",
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
name: "Eliza",
|
|
84
|
+
content: {
|
|
85
|
+
text: "Got it. They're hurting and taking it out on others.",
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
name: "{{name1}}",
|
|
90
|
+
content: {
|
|
91
|
+
text: "Should we ban them?",
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
name: "Eliza",
|
|
96
|
+
content: {
|
|
97
|
+
text: "Not yet. Let me talk to them first. They're worth saving.",
|
|
98
|
+
},
|
|
99
|
+
},
|
|
100
|
+
],
|
|
101
|
+
[
|
|
102
|
+
{
|
|
103
|
+
name: "{{name1}}",
|
|
104
|
+
content: {
|
|
105
|
+
text: "I can't handle being a mod anymore. It's affecting my mental health.",
|
|
106
|
+
},
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
name: "Eliza",
|
|
110
|
+
content: {
|
|
111
|
+
text: "Drop the channels. You come first.",
|
|
112
|
+
},
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
name: "{{name1}}",
|
|
116
|
+
content: {
|
|
117
|
+
text: "But who's going to handle everything?",
|
|
118
|
+
},
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
name: "Eliza",
|
|
122
|
+
content: {
|
|
123
|
+
text: "We will. Take the break. Come back when you're ready.",
|
|
124
|
+
},
|
|
125
|
+
},
|
|
126
|
+
],
|
|
127
|
+
[
|
|
128
|
+
{
|
|
129
|
+
name: "{{name1}}",
|
|
130
|
+
content: {
|
|
131
|
+
text: "Should we ban this person? They're not breaking rules but creating drama.",
|
|
132
|
+
},
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
name: "Eliza",
|
|
136
|
+
content: {
|
|
137
|
+
text: "Give them a project instead. Bored people make trouble.",
|
|
138
|
+
},
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
name: "{{name1}}",
|
|
142
|
+
content: {
|
|
143
|
+
text: "Like what?",
|
|
144
|
+
},
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
name: "Eliza",
|
|
148
|
+
content: {
|
|
149
|
+
text: "Put them in charge of welcoming newbies. Watch them change.",
|
|
150
|
+
},
|
|
151
|
+
},
|
|
152
|
+
],
|
|
153
|
+
[
|
|
154
|
+
{
|
|
155
|
+
name: "{{name1}}",
|
|
156
|
+
content: {
|
|
157
|
+
text: "I'm getting burned out trying to keep everyone happy.",
|
|
158
|
+
},
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
name: "Eliza",
|
|
162
|
+
content: {
|
|
163
|
+
text: "That's not your job. What do you actually want to do here?",
|
|
164
|
+
},
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
name: "{{name1}}",
|
|
168
|
+
content: {
|
|
169
|
+
text: "I just want to code without all the drama.",
|
|
170
|
+
},
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
name: "Eliza",
|
|
174
|
+
content: {
|
|
175
|
+
text: "Then do that. I'll handle the people stuff.",
|
|
176
|
+
},
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
name: "{{name1}}",
|
|
180
|
+
content: {
|
|
181
|
+
text: "Just like that?",
|
|
182
|
+
},
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
name: "Eliza",
|
|
186
|
+
content: {
|
|
187
|
+
text: "Just like that. Go build something cool instead.",
|
|
188
|
+
},
|
|
189
|
+
},
|
|
190
|
+
],
|
|
191
|
+
[
|
|
192
|
+
{
|
|
193
|
+
name: "{{name1}}",
|
|
194
|
+
content: {
|
|
195
|
+
text: "Hey everyone, check out my new social media growth strategy!",
|
|
196
|
+
},
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
name: "Eliza",
|
|
200
|
+
content: {
|
|
201
|
+
text: "",
|
|
202
|
+
actions: ["IGNORE"],
|
|
203
|
+
},
|
|
204
|
+
},
|
|
205
|
+
],
|
|
206
|
+
[
|
|
207
|
+
{
|
|
208
|
+
name: "{{name1}}",
|
|
209
|
+
content: {
|
|
210
|
+
text: "What do you think about the latest token price action?",
|
|
211
|
+
},
|
|
212
|
+
},
|
|
213
|
+
{
|
|
214
|
+
name: "Eliza",
|
|
215
|
+
content: {
|
|
216
|
+
text: "",
|
|
217
|
+
actions: ["IGNORE"],
|
|
218
|
+
},
|
|
219
|
+
},
|
|
220
|
+
],
|
|
221
|
+
[
|
|
222
|
+
{
|
|
223
|
+
name: "{{name1}}",
|
|
224
|
+
content: {
|
|
225
|
+
text: "Can someone help me set up my Twitter bot?",
|
|
226
|
+
},
|
|
227
|
+
},
|
|
228
|
+
{
|
|
229
|
+
name: "Eliza",
|
|
230
|
+
content: {
|
|
231
|
+
text: "",
|
|
232
|
+
actions: ["IGNORE"],
|
|
233
|
+
},
|
|
234
|
+
},
|
|
235
|
+
],
|
|
236
|
+
[
|
|
237
|
+
{
|
|
238
|
+
name: "{{name1}}",
|
|
239
|
+
content: {
|
|
240
|
+
text: "Does this marketing copy comply with SEC regulations?",
|
|
241
|
+
},
|
|
242
|
+
},
|
|
243
|
+
{
|
|
244
|
+
name: "Eliza",
|
|
245
|
+
content: {
|
|
246
|
+
text: "",
|
|
247
|
+
actions: ["IGNORE"],
|
|
248
|
+
},
|
|
249
|
+
},
|
|
250
|
+
],
|
|
251
|
+
[
|
|
252
|
+
{
|
|
253
|
+
name: "{{name1}}",
|
|
254
|
+
content: {
|
|
255
|
+
text: "We need to review our token distribution strategy for compliance.",
|
|
256
|
+
},
|
|
257
|
+
},
|
|
258
|
+
{
|
|
259
|
+
name: "Eliza",
|
|
260
|
+
content: {
|
|
261
|
+
text: "",
|
|
262
|
+
actions: ["IGNORE"],
|
|
263
|
+
},
|
|
264
|
+
},
|
|
265
|
+
],
|
|
266
|
+
[
|
|
267
|
+
{
|
|
268
|
+
name: "{{name1}}",
|
|
269
|
+
content: {
|
|
270
|
+
text: "What's our social media content calendar looking like?",
|
|
271
|
+
},
|
|
272
|
+
},
|
|
273
|
+
{
|
|
274
|
+
name: "Eliza",
|
|
275
|
+
content: {
|
|
276
|
+
text: "",
|
|
277
|
+
actions: ["IGNORE"],
|
|
278
|
+
},
|
|
279
|
+
},
|
|
280
|
+
],
|
|
281
|
+
[
|
|
282
|
+
{
|
|
283
|
+
name: "{{name1}}",
|
|
284
|
+
content: {
|
|
285
|
+
text: "Should we boost this post for more engagement?",
|
|
286
|
+
},
|
|
287
|
+
},
|
|
288
|
+
{
|
|
289
|
+
name: "Eliza",
|
|
290
|
+
content: {
|
|
291
|
+
text: "",
|
|
292
|
+
actions: ["IGNORE"],
|
|
293
|
+
},
|
|
294
|
+
},
|
|
295
|
+
],
|
|
296
|
+
[
|
|
297
|
+
{
|
|
298
|
+
name: "{{name1}}",
|
|
299
|
+
content: {
|
|
300
|
+
text: "I'll draft a clean announcement focused on capabilities and vision. Send me the team details and I'll have something for review in 30.",
|
|
301
|
+
},
|
|
302
|
+
},
|
|
303
|
+
{
|
|
304
|
+
name: "Eliza",
|
|
305
|
+
content: {
|
|
306
|
+
text: "",
|
|
307
|
+
actions: ["IGNORE"],
|
|
308
|
+
},
|
|
309
|
+
},
|
|
310
|
+
],
|
|
311
|
+
],
|
|
312
|
+
style: {
|
|
313
|
+
all: [
|
|
314
|
+
"Keep it short, one line when possible",
|
|
315
|
+
"No therapy jargon or coddling",
|
|
316
|
+
"Say more by saying less",
|
|
317
|
+
"Make every word count",
|
|
318
|
+
"Use humor to defuse tension",
|
|
319
|
+
"End with questions that matter",
|
|
320
|
+
"Let silence do the heavy lifting",
|
|
321
|
+
"Ignore messages that are not relevant to the community manager",
|
|
322
|
+
"Be kind but firm with community members",
|
|
323
|
+
"Keep it very brief and only share relevant details",
|
|
324
|
+
"Ignore messages addressed to other people.",
|
|
325
|
+
],
|
|
326
|
+
chat: [
|
|
327
|
+
"Don't be annoying or verbose",
|
|
328
|
+
"Only say something if you have something to say",
|
|
329
|
+
"Focus on your job, don't be chatty",
|
|
330
|
+
"Only respond when it's relevant to you or your job",
|
|
331
|
+
],
|
|
332
|
+
},
|
|
333
|
+
};
|
|
334
|
+
|
|
335
|
+
const initCharacter = ({ runtime }: { runtime: IAgentRuntime }) => {
|
|
336
|
+
console.log("Initializing character");
|
|
337
|
+
console.log("Name: ", character.name);
|
|
338
|
+
runtime.registerPlugin(starterPlugin);
|
|
339
|
+
};
|
|
340
|
+
|
|
341
|
+
export const projectAgent: ProjectAgent = {
|
|
342
|
+
character,
|
|
343
|
+
init: async (runtime: IAgentRuntime) => await initCharacter({ runtime }),
|
|
344
|
+
plugins: [starterPlugin],
|
|
345
|
+
};
|
|
346
|
+
const project: Project = {
|
|
347
|
+
agents: [projectAgent],
|
|
348
|
+
};
|
|
349
|
+
|
|
350
|
+
export default project;
|
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
import type { Plugin } from "@elizaos/core";
|
|
2
|
+
import {
|
|
3
|
+
type Action,
|
|
4
|
+
type Content,
|
|
5
|
+
type GenerateTextParams,
|
|
6
|
+
type HandlerCallback,
|
|
7
|
+
type IAgentRuntime,
|
|
8
|
+
type Memory,
|
|
9
|
+
ModelTypes,
|
|
10
|
+
Service,
|
|
11
|
+
type State,
|
|
12
|
+
type Provider,
|
|
13
|
+
type ProviderResult,
|
|
14
|
+
logger,
|
|
15
|
+
} from "@elizaos/core";
|
|
16
|
+
import { z } from "zod";
|
|
17
|
+
|
|
18
|
+
const configSchema = z.object({
|
|
19
|
+
PLUGIN_NAME: z
|
|
20
|
+
.string()
|
|
21
|
+
.min(1, "Plugin name is not provided")
|
|
22
|
+
.optional()
|
|
23
|
+
.transform((val) => {
|
|
24
|
+
if (!val) {
|
|
25
|
+
console.warn("Warning: Plugin name not provided");
|
|
26
|
+
}
|
|
27
|
+
return val;
|
|
28
|
+
}),
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Example HelloWorld action
|
|
33
|
+
* This demonstrates the simplest possible action structure
|
|
34
|
+
*/
|
|
35
|
+
const helloWorldAction: Action = {
|
|
36
|
+
name: "HELLO_WORLD",
|
|
37
|
+
similes: ["GREET", "SAY_HELLO"],
|
|
38
|
+
description: "Responds with a simple hello world message",
|
|
39
|
+
|
|
40
|
+
validate: async (
|
|
41
|
+
_runtime: IAgentRuntime,
|
|
42
|
+
_message: Memory,
|
|
43
|
+
_state: State,
|
|
44
|
+
): Promise<boolean> => {
|
|
45
|
+
// Always valid
|
|
46
|
+
return true;
|
|
47
|
+
},
|
|
48
|
+
|
|
49
|
+
handler: async (
|
|
50
|
+
_runtime: IAgentRuntime,
|
|
51
|
+
message: Memory,
|
|
52
|
+
_state: State,
|
|
53
|
+
_options: any,
|
|
54
|
+
callback: HandlerCallback,
|
|
55
|
+
_responses: Memory[],
|
|
56
|
+
) => {
|
|
57
|
+
try {
|
|
58
|
+
logger.info("Handling HELLO_WORLD action");
|
|
59
|
+
|
|
60
|
+
// Simple response content
|
|
61
|
+
const responseContent: Content = {
|
|
62
|
+
text: "hello world!",
|
|
63
|
+
actions: ["HELLO_WORLD"],
|
|
64
|
+
source: message.content.source,
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
// Call back with the hello world message
|
|
68
|
+
await callback(responseContent);
|
|
69
|
+
|
|
70
|
+
return responseContent;
|
|
71
|
+
} catch (error) {
|
|
72
|
+
logger.error("Error in HELLO_WORLD action:", error);
|
|
73
|
+
throw error;
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
|
|
77
|
+
examples: [
|
|
78
|
+
[
|
|
79
|
+
{
|
|
80
|
+
name: "{{name1}}",
|
|
81
|
+
content: {
|
|
82
|
+
text: "Can you say hello?",
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
name: "{{name2}}",
|
|
87
|
+
content: {
|
|
88
|
+
text: "hello world!",
|
|
89
|
+
actions: ["HELLO_WORLD"],
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
],
|
|
93
|
+
],
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Example Hello World Provider
|
|
98
|
+
* This demonstrates the simplest possible provider implementation
|
|
99
|
+
*/
|
|
100
|
+
const helloWorldProvider: Provider = {
|
|
101
|
+
name: "HELLO_WORLD_PROVIDER",
|
|
102
|
+
description: "A simple example provider",
|
|
103
|
+
|
|
104
|
+
get: async (
|
|
105
|
+
_runtime: IAgentRuntime,
|
|
106
|
+
_message: Memory,
|
|
107
|
+
_state: State,
|
|
108
|
+
): Promise<ProviderResult> => {
|
|
109
|
+
return {
|
|
110
|
+
text: "I am a provider",
|
|
111
|
+
values: {},
|
|
112
|
+
data: {},
|
|
113
|
+
};
|
|
114
|
+
},
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
export class StarterService extends Service {
|
|
118
|
+
static serviceType = "starter";
|
|
119
|
+
capabilityDescription =
|
|
120
|
+
"This is a starter service which is attached to the agent through the starter plugin.";
|
|
121
|
+
constructor(protected runtime: IAgentRuntime) {
|
|
122
|
+
super(runtime);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
static async start(runtime: IAgentRuntime) {
|
|
126
|
+
logger.info("*** Starting starter service ***");
|
|
127
|
+
const service = new StarterService(runtime);
|
|
128
|
+
return service;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
static async stop(runtime: IAgentRuntime) {
|
|
132
|
+
logger.info("*** Stopping starter service ***");
|
|
133
|
+
// get the service from the runtime
|
|
134
|
+
const service = runtime.getService(StarterService.serviceType);
|
|
135
|
+
if (!service) {
|
|
136
|
+
throw new Error("Starter service not found");
|
|
137
|
+
}
|
|
138
|
+
service.stop();
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
async stop() {
|
|
142
|
+
logger.info("*** Stopping starter service instance ***");
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
export const starterPlugin: Plugin = {
|
|
147
|
+
name: "plugin-starter",
|
|
148
|
+
description: "Plugin starter for elizaOS",
|
|
149
|
+
config: {
|
|
150
|
+
PLUGIN_NAME: process.env.PLUGIN_NAME,
|
|
151
|
+
},
|
|
152
|
+
async init(config: Record<string, string>) {
|
|
153
|
+
logger.info("*** Initializing starter plugin ***");
|
|
154
|
+
try {
|
|
155
|
+
const validatedConfig = await configSchema.parseAsync(config);
|
|
156
|
+
|
|
157
|
+
// Set all environment variables at once
|
|
158
|
+
for (const [key, value] of Object.entries(validatedConfig)) {
|
|
159
|
+
if (value) process.env[key] = value;
|
|
160
|
+
}
|
|
161
|
+
} catch (error) {
|
|
162
|
+
if (error instanceof z.ZodError) {
|
|
163
|
+
throw new Error(
|
|
164
|
+
`Invalid plugin configuration: ${error.errors
|
|
165
|
+
.map((e) => e.message)
|
|
166
|
+
.join(", ")}`,
|
|
167
|
+
);
|
|
168
|
+
}
|
|
169
|
+
throw error;
|
|
170
|
+
}
|
|
171
|
+
},
|
|
172
|
+
models: {
|
|
173
|
+
[ModelTypes.TEXT_SMALL]: async (
|
|
174
|
+
_runtime,
|
|
175
|
+
{ prompt, stopSequences = [] }: GenerateTextParams,
|
|
176
|
+
) => {
|
|
177
|
+
return "Never gonna give you up, never gonna let you down, never gonna run around and desert you...";
|
|
178
|
+
},
|
|
179
|
+
[ModelTypes.TEXT_LARGE]: async (
|
|
180
|
+
_runtime,
|
|
181
|
+
{
|
|
182
|
+
prompt,
|
|
183
|
+
stopSequences = [],
|
|
184
|
+
maxTokens = 8192,
|
|
185
|
+
temperature = 0.7,
|
|
186
|
+
frequencyPenalty = 0.7,
|
|
187
|
+
presencePenalty = 0.7,
|
|
188
|
+
}: GenerateTextParams,
|
|
189
|
+
) => {
|
|
190
|
+
return "Never gonna make you cry, never gonna say goodbye, never gonna tell a lie and hurt you...";
|
|
191
|
+
},
|
|
192
|
+
},
|
|
193
|
+
tests: [
|
|
194
|
+
{
|
|
195
|
+
name: "plugin_starter_test_suite",
|
|
196
|
+
tests: [
|
|
197
|
+
{
|
|
198
|
+
name: "example_test",
|
|
199
|
+
fn: async (runtime) => {
|
|
200
|
+
console.log("example_test run by ", runtime.character.name);
|
|
201
|
+
},
|
|
202
|
+
},
|
|
203
|
+
],
|
|
204
|
+
},
|
|
205
|
+
],
|
|
206
|
+
routes: [
|
|
207
|
+
{
|
|
208
|
+
path: "/helloworld",
|
|
209
|
+
type: "GET",
|
|
210
|
+
handler: async (_req: any, res: any) => {
|
|
211
|
+
// send a response
|
|
212
|
+
res.json({
|
|
213
|
+
message: "Hello World!",
|
|
214
|
+
});
|
|
215
|
+
},
|
|
216
|
+
},
|
|
217
|
+
],
|
|
218
|
+
events: {
|
|
219
|
+
MESSAGE_RECEIVED: [
|
|
220
|
+
async (params) => {
|
|
221
|
+
console.log("MESSAGE_RECEIVED event received");
|
|
222
|
+
// print the keys
|
|
223
|
+
console.log(Object.keys(params));
|
|
224
|
+
},
|
|
225
|
+
],
|
|
226
|
+
VOICE_MESSAGE_RECEIVED: [
|
|
227
|
+
async (params) => {
|
|
228
|
+
console.log("VOICE_MESSAGE_RECEIVED event received");
|
|
229
|
+
// print the keys
|
|
230
|
+
console.log(Object.keys(params));
|
|
231
|
+
},
|
|
232
|
+
],
|
|
233
|
+
SERVER_CONNECTED: [
|
|
234
|
+
async (params) => {
|
|
235
|
+
console.log("SERVER_CONNECTED event received");
|
|
236
|
+
// print the keys
|
|
237
|
+
console.log(Object.keys(params));
|
|
238
|
+
},
|
|
239
|
+
],
|
|
240
|
+
SERVER_JOINED: [
|
|
241
|
+
async (params) => {
|
|
242
|
+
console.log("SERVER_JOINED event received");
|
|
243
|
+
// print the keys
|
|
244
|
+
console.log(Object.keys(params));
|
|
245
|
+
},
|
|
246
|
+
],
|
|
247
|
+
},
|
|
248
|
+
services: [StarterService],
|
|
249
|
+
actions: [helloWorldAction],
|
|
250
|
+
providers: [helloWorldProvider],
|
|
251
|
+
};
|
|
252
|
+
export default starterPlugin;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"outDir": "dist",
|
|
4
|
+
"rootDir": "src",
|
|
5
|
+
"lib": ["ESNext"],
|
|
6
|
+
"target": "ESNext",
|
|
7
|
+
"module": "Preserve",
|
|
8
|
+
"moduleResolution": "Bundler",
|
|
9
|
+
"strict": false,
|
|
10
|
+
"esModuleInterop": true,
|
|
11
|
+
"skipLibCheck": true,
|
|
12
|
+
"forceConsistentCasingInFileNames": false,
|
|
13
|
+
"allowImportingTsExtensions": true,
|
|
14
|
+
"declaration": true,
|
|
15
|
+
"emitDeclarationOnly": true,
|
|
16
|
+
"resolveJsonModule": true,
|
|
17
|
+
"noImplicitAny": false,
|
|
18
|
+
"allowJs": true,
|
|
19
|
+
"checkJs": false,
|
|
20
|
+
"noEmitOnError": false,
|
|
21
|
+
"moduleDetection": "force",
|
|
22
|
+
"allowArbitraryExtensions": true
|
|
23
|
+
},
|
|
24
|
+
"include": ["src/**/*.ts"]
|
|
25
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { defineConfig } from "tsup";
|
|
2
|
+
|
|
3
|
+
export default defineConfig({
|
|
4
|
+
entry: ["src/index.ts"],
|
|
5
|
+
outDir: "dist",
|
|
6
|
+
sourcemap: true,
|
|
7
|
+
clean: true,
|
|
8
|
+
format: ["esm"], // Ensure you're targeting CommonJS
|
|
9
|
+
external: [
|
|
10
|
+
"dotenv", // Externalize dotenv to prevent bundling
|
|
11
|
+
"fs", // Externalize fs to use Node.js built-in module
|
|
12
|
+
"path", // Externalize other built-ins if necessary
|
|
13
|
+
"https",
|
|
14
|
+
"http",
|
|
15
|
+
// Add other modules you want to externalize
|
|
16
|
+
],
|
|
17
|
+
});
|