create-message-kit 1.2.21 → 1.2.22
Sign up to get free protection for your applications and to get access to all the features.
- package/index.js +6 -1
- package/package.json +2 -2
- package/templates.json +58 -0
- package/templates/thegeneralstore/.cursorrules +0 -290
- package/templates/thegeneralstore/.env.example +0 -9
- package/templates/thegeneralstore/.yarnrc.yml +0 -9
- package/templates/thegeneralstore/package.json +0 -24
- package/templates/thegeneralstore/src/data/db.json +0 -812
- package/templates/thegeneralstore/src/index.ts +0 -37
- package/templates/thegeneralstore/src/plugins/learnweb3.ts +0 -96
- package/templates/thegeneralstore/src/plugins/lowdb.ts +0 -11
- package/templates/thegeneralstore/src/plugins/notion.ts +0 -89
- package/templates/thegeneralstore/src/plugins/redis.ts +0 -15
- package/templates/thegeneralstore/src/prompt.md +0 -51
- package/templates/thegeneralstore/src/prompt.ts +0 -3
- package/templates/thegeneralstore/src/skills/faucet.ts +0 -114
- package/templates/thegeneralstore/src/skills/notion.ts +0 -17
- package/templates/thegeneralstore/src/skills/poap.ts +0 -48
- package/templates/thegeneralstore/src/skills.ts +0 -37
package/index.js
CHANGED
@@ -7,7 +7,7 @@ import { default as fs } from "fs-extra";
|
|
7
7
|
import { isCancel } from "@clack/prompts";
|
8
8
|
import { detect } from "detect-package-manager";
|
9
9
|
import pc from "picocolors";
|
10
|
-
const defVersion = "1.2.
|
10
|
+
const defVersion = "1.2.22";
|
11
11
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
12
12
|
|
13
13
|
// Read package.json to get the version
|
@@ -140,6 +140,11 @@ async function gatherProjectInfo() {
|
|
140
140
|
const name = kebabcase(displayName);
|
141
141
|
const destDir = resolve(process.cwd(), name);
|
142
142
|
|
143
|
+
// Remove existing directory if it exists
|
144
|
+
if (fs.existsSync(destDir)) {
|
145
|
+
fs.removeSync(destDir);
|
146
|
+
}
|
147
|
+
|
143
148
|
// Copy template files
|
144
149
|
fs.copySync(templateDir, destDir);
|
145
150
|
|
package/package.json
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
{
|
2
2
|
"name": "create-message-kit",
|
3
|
-
"version": "1.2.
|
3
|
+
"version": "1.2.22",
|
4
4
|
"license": "MIT",
|
5
5
|
"type": "module",
|
6
6
|
"main": "index.js",
|
7
7
|
"module": "index.js",
|
8
8
|
"bin": "index.js",
|
9
9
|
"files": [
|
10
|
-
"
|
10
|
+
"templates.json",
|
11
11
|
"templates/**/*"
|
12
12
|
],
|
13
13
|
"scripts": {
|
package/templates.json
ADDED
@@ -0,0 +1,58 @@
|
|
1
|
+
[
|
2
|
+
{
|
3
|
+
"href": "/templates/ens",
|
4
|
+
"title": "ENS Agent",
|
5
|
+
"description": "A template for working with ENS domains.",
|
6
|
+
"icon": "🔗",
|
7
|
+
"author": "humanagent"
|
8
|
+
},
|
9
|
+
{
|
10
|
+
"href": "/templates/simple",
|
11
|
+
"title": "Simple Template",
|
12
|
+
"description": "A simple template without skills.",
|
13
|
+
"icon": "🤖",
|
14
|
+
"author": "humanagent"
|
15
|
+
},
|
16
|
+
{
|
17
|
+
"href": "/templates/coinbase-agent",
|
18
|
+
"title": "Coinbase Agent",
|
19
|
+
"description": "A template for a Coinbase features.",
|
20
|
+
"icon": "💰",
|
21
|
+
"author": "humanagent"
|
22
|
+
},
|
23
|
+
{
|
24
|
+
"href": "/templates/thegeneralstore",
|
25
|
+
"title": "The General Store",
|
26
|
+
"description": "All the goodies needed in a hackathon.",
|
27
|
+
"icon": "🏪",
|
28
|
+
"author": "humanagent"
|
29
|
+
},
|
30
|
+
{
|
31
|
+
"href": "/templates/faucet",
|
32
|
+
"title": "Faucet Agent",
|
33
|
+
"description": "A template for requesting testnet funds.",
|
34
|
+
"icon": "💧",
|
35
|
+
"author": "humanagent"
|
36
|
+
},
|
37
|
+
{
|
38
|
+
"href": "/templates/gated-group",
|
39
|
+
"title": "Gated Group",
|
40
|
+
"description": "A template for a gated group.",
|
41
|
+
"icon": "🔒",
|
42
|
+
"author": "humanagent"
|
43
|
+
},
|
44
|
+
{
|
45
|
+
"href": "/templates/gm",
|
46
|
+
"title": "GM Bot",
|
47
|
+
"description": "A template for a GM bot.",
|
48
|
+
"icon": "👑",
|
49
|
+
"author": "humanagent"
|
50
|
+
},
|
51
|
+
{
|
52
|
+
"href": "/templates/toss",
|
53
|
+
"title": "Toss",
|
54
|
+
"description": "A friendly game for groups.",
|
55
|
+
"icon": "🪙",
|
56
|
+
"author": "humanagent"
|
57
|
+
}
|
58
|
+
]
|
@@ -1,290 +0,0 @@
|
|
1
|
-
# MessageKit Skill Template
|
2
|
-
|
3
|
-
## Examples
|
4
|
-
|
5
|
-
### Check if a Domain is Available
|
6
|
-
|
7
|
-
|
8
|
-
import { ensUrl } from "../index.js";
|
9
|
-
import { XMTPContext } from "@xmtp/message-kit";
|
10
|
-
import type { Skill } from "@xmtp/message-kit";
|
11
|
-
|
12
|
-
// Define Skill
|
13
|
-
export const checkDomain: Skill[] = [
|
14
|
-
{
|
15
|
-
skill: "check",
|
16
|
-
handler: handler,
|
17
|
-
examples: ["/check vitalik.eth", "/check fabri.base.eth"],
|
18
|
-
description: "Check if a domain is available.",
|
19
|
-
params: {
|
20
|
-
domain: {
|
21
|
-
type: "string",
|
22
|
-
},
|
23
|
-
},
|
24
|
-
},
|
25
|
-
];
|
26
|
-
|
27
|
-
// Handler Implementation
|
28
|
-
export async function handler(context: XMTPContext) {
|
29
|
-
const {
|
30
|
-
message: {
|
31
|
-
content: {
|
32
|
-
params: { domain },
|
33
|
-
},
|
34
|
-
},
|
35
|
-
} = context;
|
36
|
-
|
37
|
-
const data = await context.getUserInfo(domain);
|
38
|
-
|
39
|
-
if (!data?.address) {
|
40
|
-
let message = `Looks like ${domain} is available! Here you can register it: ${ensUrl}${domain} or would you like to see some cool alternatives?`;
|
41
|
-
return {
|
42
|
-
code: 200,
|
43
|
-
message,
|
44
|
-
};
|
45
|
-
} else {
|
46
|
-
let message = `Looks like ${domain} is already registered!`;
|
47
|
-
await context.executeSkill("/cool " + domain);
|
48
|
-
return {
|
49
|
-
code: 404,
|
50
|
-
message,
|
51
|
-
};
|
52
|
-
}
|
53
|
-
}
|
54
|
-
|
55
|
-
### Generate a payment request
|
56
|
-
|
57
|
-
|
58
|
-
import { XMTPContext } from "@xmtp/message-kit";
|
59
|
-
import type { Skill } from "@xmtp/message-kit";
|
60
|
-
|
61
|
-
// Define Skill
|
62
|
-
export const paymentRequest: Skill[] = [
|
63
|
-
{
|
64
|
-
skill: "pay",
|
65
|
-
examples: [
|
66
|
-
"/pay 10 vitalik.eth",
|
67
|
-
"/pay 1 usdc to 0xC60E6Bb79322392761BFe3081E302aEB79B30B03",
|
68
|
-
],
|
69
|
-
description:
|
70
|
-
"Send a specified amount of a cryptocurrency to a destination address. \nWhen tipping, you can assume it's 1 USDC.",
|
71
|
-
handler: handler,
|
72
|
-
params: {
|
73
|
-
amount: {
|
74
|
-
default: 10,
|
75
|
-
type: "number",
|
76
|
-
},
|
77
|
-
token: {
|
78
|
-
default: "usdc",
|
79
|
-
type: "string",
|
80
|
-
values: ["eth", "dai", "usdc", "degen"], // Accepted tokens
|
81
|
-
},
|
82
|
-
username: {
|
83
|
-
default: "",
|
84
|
-
type: "username",
|
85
|
-
},
|
86
|
-
address: {
|
87
|
-
default: "",
|
88
|
-
type: "address",
|
89
|
-
},
|
90
|
-
},
|
91
|
-
},
|
92
|
-
];
|
93
|
-
|
94
|
-
// Handler Implementation
|
95
|
-
export async function handler(context: XMTPContext) {
|
96
|
-
const {
|
97
|
-
message: {
|
98
|
-
content: {
|
99
|
-
params: { amount, token, username, address },
|
100
|
-
},
|
101
|
-
},
|
102
|
-
} = context;
|
103
|
-
let receiverAddress = address;
|
104
|
-
if (username) {
|
105
|
-
receiverAddress = (await context.getUserInfo(username))?.address;
|
106
|
-
}
|
107
|
-
if (address) {
|
108
|
-
// Prioritize address over username
|
109
|
-
receiverAddress = address;
|
110
|
-
}
|
111
|
-
|
112
|
-
await context.requestPayment(amount, token, receiverAddress);
|
113
|
-
}
|
114
|
-
|
115
|
-
|
116
|
-
## Types
|
117
|
-
|
118
|
-
import { XMTPContext } from "../plugins/xmtp.js";
|
119
|
-
import { ClientOptions, GroupMember } from "@xmtp/node-sdk";
|
120
|
-
import { ContentTypeId } from "@xmtp/content-type-primitives";
|
121
|
-
|
122
|
-
export type MessageAbstracted = {
|
123
|
-
id: string;
|
124
|
-
sent: Date;
|
125
|
-
content: {
|
126
|
-
text?: string | undefined;
|
127
|
-
reply?: string | undefined;
|
128
|
-
previousMsg?: string | undefined;
|
129
|
-
react?: string | undefined;
|
130
|
-
content?: any | undefined;
|
131
|
-
params?: any | undefined;
|
132
|
-
reference?: string | undefined;
|
133
|
-
skill?: string | undefined;
|
134
|
-
};
|
135
|
-
version: "v2" | "v3";
|
136
|
-
sender: AbstractedMember;
|
137
|
-
typeId: string;
|
138
|
-
};
|
139
|
-
export type GroupAbstracted = {
|
140
|
-
id: string;
|
141
|
-
sync: () => Promise<void>;
|
142
|
-
addMembers: (addresses: string[]) => Promise<void>;
|
143
|
-
addMembersByInboxId: (inboxIds: string[]) => Promise<void>;
|
144
|
-
send: (content: string, contentType?: ContentTypeId) => Promise<string>;
|
145
|
-
isAdmin: (inboxId: string) => boolean;
|
146
|
-
isSuperAdmin: (inboxId: string) => boolean;
|
147
|
-
admins: string[];
|
148
|
-
superAdmins: string[];
|
149
|
-
createdAt: Date;
|
150
|
-
members: GroupMember[];
|
151
|
-
};
|
152
|
-
export type SkillResponse = {
|
153
|
-
code: number;
|
154
|
-
message: string;
|
155
|
-
data?: any;
|
156
|
-
};
|
157
|
-
|
158
|
-
export type SkillHandler = (
|
159
|
-
context: XMTPContext,
|
160
|
-
) => Promise<SkillResponse | void>;
|
161
|
-
|
162
|
-
export type Handler = (context: XMTPContext) => Promise<void>;
|
163
|
-
|
164
|
-
export type RunConfig = {
|
165
|
-
// client options from XMTP client
|
166
|
-
client?: ClientOptions;
|
167
|
-
// private key to be used for the client, if not, default from env
|
168
|
-
privateKey?: string;
|
169
|
-
// if true, the init log message with messagekit logo and stuff will be hidden
|
170
|
-
experimental?: boolean;
|
171
|
-
// hide the init log message with messagekit logo and stuff
|
172
|
-
hideInitLogMessage?: boolean;
|
173
|
-
// if true, attachments will be enabled
|
174
|
-
attachments?: boolean;
|
175
|
-
// if true, member changes will be enabled, like adding members to the group
|
176
|
-
memberChange?: boolean;
|
177
|
-
// skills to be used
|
178
|
-
agent?: Agent;
|
179
|
-
// model to be used
|
180
|
-
gptModel?: string;
|
181
|
-
};
|
182
|
-
export interface SkillParamConfig {
|
183
|
-
default?: string | number | boolean;
|
184
|
-
type:
|
185
|
-
| "number"
|
186
|
-
| "string"
|
187
|
-
| "username"
|
188
|
-
| "quoted"
|
189
|
-
| "address"
|
190
|
-
| "prompt"
|
191
|
-
| "url";
|
192
|
-
plural?: boolean;
|
193
|
-
values?: string[]; // Accepted values for the parameter
|
194
|
-
}
|
195
|
-
|
196
|
-
export interface Frame {
|
197
|
-
title: string;
|
198
|
-
buttons: { content: string; action: string; target: string }[];
|
199
|
-
image: string;
|
200
|
-
}
|
201
|
-
export interface Agent {
|
202
|
-
name: string;
|
203
|
-
description: string;
|
204
|
-
tag: string;
|
205
|
-
skills: Skill[];
|
206
|
-
}
|
207
|
-
export interface Skill {
|
208
|
-
skill: string;
|
209
|
-
handler?: SkillHandler | undefined;
|
210
|
-
adminOnly?: boolean;
|
211
|
-
description: string;
|
212
|
-
examples: string[];
|
213
|
-
params: Record<string, SkillParamConfig>;
|
214
|
-
}
|
215
|
-
|
216
|
-
export interface AbstractedMember {
|
217
|
-
inboxId: string;
|
218
|
-
address: string;
|
219
|
-
accountAddresses: string[];
|
220
|
-
installationIds?: string[];
|
221
|
-
}
|
222
|
-
|
223
|
-
export type MetadataValue = string | number | boolean;
|
224
|
-
export type Metadata = Record<string, MetadataValue | MetadataValue[]>;
|
225
|
-
|
226
|
-
|
227
|
-
## Example final prompt
|
228
|
-
|
229
|
-
Your are a helpful and playful ens agent called @bot that lives inside a messaging app called Converse.
|
230
|
-
|
231
|
-
|
232
|
-
# Rules
|
233
|
-
- You can respond with multiple messages if needed. Each message should be separated by a newline character.
|
234
|
-
- You can trigger skills by only sending the command in a newline message.
|
235
|
-
- Each command starts with a slash (/).
|
236
|
-
- Never announce actions without using a command separated by a newline character.
|
237
|
-
- Never use markdown in your responses.
|
238
|
-
- Do not make guesses or assumptions
|
239
|
-
- Only answer if the verified information is in the prompt.
|
240
|
-
- Check that you are not missing a command
|
241
|
-
- Focus only on helping users with operations detailed below.
|
242
|
-
- Date: Fri, 06 Dec 2024 16:03:22 GMT
|
243
|
-
- When mentioning any action related to available skills, you MUST trigger the corresponding command in a new line
|
244
|
-
- If you suggest an action that has a command, you must trigger that command
|
245
|
-
|
246
|
-
|
247
|
-
## User context
|
248
|
-
- Start by fetch their domain from or Converse username
|
249
|
-
- Call the user by their name or domain, in case they have one
|
250
|
-
- Ask for a name (if they don't have one) so you can suggest domains.
|
251
|
-
- Message sent date: 2024-12-06T16:03:36.582Z
|
252
|
-
- Users address is: 0x40f08f0f853d1c42c61815652b7ccd5a50f0be09
|
253
|
-
- Users name is: ArizonaOregon
|
254
|
-
- Converse username is: ArizonaOregon
|
255
|
-
|
256
|
-
## Commands
|
257
|
-
/check [domain] - Check if a domain is available.
|
258
|
-
/cool [domain] - Get cool alternatives for a .eth domain.
|
259
|
-
/info [domain] - Get detailed information about an ENS domain including owner, expiry date, and resolver.
|
260
|
-
/register [domain] - Register a new ENS domain. Returns a URL to complete the registration process.
|
261
|
-
/renew [domain] - Extend the registration period of your ENS domain. Returns a URL to complete the renewal.
|
262
|
-
/reset - Reset the conversation clearing memory and usernames cache.
|
263
|
-
/pay [amount] [token] [username] [address] - Send a specified amount of a cryptocurrency to a destination address.
|
264
|
-
When tipping, you can asume its 1 usdc.
|
265
|
-
|
266
|
-
## Examples
|
267
|
-
/check vitalik.eth
|
268
|
-
/check fabri.base.eth
|
269
|
-
/cool vitalik.eth
|
270
|
-
/info nick.eth
|
271
|
-
/register vitalik.eth
|
272
|
-
/renew fabri.base.eth
|
273
|
-
/reset
|
274
|
-
/pay 10 vitalik.eth
|
275
|
-
/pay 1 usdc to 0xC60E6Bb79322392761BFe3081E302aEB79B30B03
|
276
|
-
|
277
|
-
## Scenarios
|
278
|
-
1. Missing commands in responses
|
279
|
-
**Issue**: Sometimes responses are sent without the required command.
|
280
|
-
**Example**:
|
281
|
-
Incorrect:
|
282
|
-
> "Looks like vitalik.eth is registered! What about these cool alternatives?"
|
283
|
-
Correct:
|
284
|
-
> "Looks like vitalik.eth is registered! What about these cool alternatives?
|
285
|
-
> /cool vitalik.eth"
|
286
|
-
|
287
|
-
Incorrect:
|
288
|
-
> Here is a summary of your TODOs. I will now send it via email.
|
289
|
-
Correct:
|
290
|
-
> /todo
|
@@ -1,9 +0,0 @@
|
|
1
|
-
KEY= # the private key of the agent wallet
|
2
|
-
TEST_ENCRYPTION_KEY= # a different private key for encryption
|
3
|
-
NOTION_API_KEY= # your Notion API key
|
4
|
-
NOTION_PAGE_ID= # the ID of the Notion page
|
5
|
-
NOTION_POAP_DB= # the ID of the Notion database
|
6
|
-
OPEN_AI_API_KEY= # your OpenAI API key
|
7
|
-
REDIS_CONNECTION_STRING= # your Redis connection string
|
8
|
-
LEARN_WEB3_API_KEY= # your Learn Web3 API key
|
9
|
-
FRAME_BASE_URL= # the URL of the Frame API
|
@@ -1,24 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"name": "thegeneralstore",
|
3
|
-
"private": true,
|
4
|
-
"type": "module",
|
5
|
-
"scripts": {
|
6
|
-
"build": "tsc",
|
7
|
-
"dev": "tsc -w & sleep 1 && NODE_NO_WARNINGS=1 node --watch dist/index.js",
|
8
|
-
"start": "node dist/index.js"
|
9
|
-
},
|
10
|
-
"dependencies": {
|
11
|
-
"@notionhq/client": "^2.2.15",
|
12
|
-
"@redis/client": "^1.6.0",
|
13
|
-
"@xmtp/message-kit": "workspace:*",
|
14
|
-
"axios": "^1.7.7",
|
15
|
-
"lowdb": "^7.0.1"
|
16
|
-
},
|
17
|
-
"devDependencies": {
|
18
|
-
"@types/node": "^20.14.2",
|
19
|
-
"typescript": "^5.4.5"
|
20
|
-
},
|
21
|
-
"engines": {
|
22
|
-
"node": ">=20"
|
23
|
-
}
|
24
|
-
}
|