create-message-kit 1.2.22 → 1.2.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -5
- package/index.js +15 -15
- package/package.json +1 -2
- package/templates/ens/.cursorrules +0 -112
- package/templates/ens/package.json +1 -2
- package/templates/ens/src/index.ts +4 -38
- package/templates/ens/src/prompt.ts +1 -1
- package/templates/ens/src/skills/info.ts +6 -3
- package/templates/simple/.cursorrules +0 -112
- package/templates/simple/src/index.ts +10 -9
- package/templates/coinbase-agent/.cursorrules +0 -290
- package/templates/coinbase-agent/.env.example +0 -4
- package/templates/coinbase-agent/.yarnrc.yml +0 -9
- package/templates/coinbase-agent/package.json +0 -22
- package/templates/coinbase-agent/src/index.ts +0 -31
- package/templates/coinbase-agent/src/plugins/learnweb3.ts +0 -96
- package/templates/coinbase-agent/src/plugins/redis.ts +0 -15
- package/templates/coinbase-agent/src/prompt.ts +0 -64
- package/templates/coinbase-agent/src/skills/drip.ts +0 -83
- package/templates/coinbase-agent/src/skills/mint.ts +0 -99
- package/templates/coinbase-agent/src/skills/pay.ts +0 -35
- package/templates/coinbase-agent/src/skills/swap.ts +0 -52
- package/templates/faucet/.cursorrules +0 -290
- package/templates/faucet/.env.example +0 -5
- package/templates/faucet/.yarnrc.yml +0 -9
- package/templates/faucet/package.json +0 -22
- package/templates/faucet/src/index.ts +0 -39
- package/templates/faucet/src/plugins/learnweb3.ts +0 -96
- package/templates/faucet/src/plugins/redis.ts +0 -15
- package/templates/faucet/src/prompt.ts +0 -11
- package/templates/faucet/src/skills/faucet.ts +0 -140
- package/templates/gated-group/.cursorrules +0 -290
- package/templates/gated-group/.env.example +0 -3
- package/templates/gated-group/.yarnrc.yml +0 -9
- package/templates/gated-group/package.json +0 -23
- package/templates/gated-group/src/index.ts +0 -17
- package/templates/gated-group/src/plugins/alchemy.ts +0 -27
- package/templates/gated-group/src/plugins/xmtp.ts +0 -137
- package/templates/gated-group/src/prompt.ts +0 -11
- package/templates/gated-group/src/skills/gated.ts +0 -88
- package/templates/gm/.cursorrules +0 -290
- package/templates/gm/.env.example +0 -2
- package/templates/gm/.yarnrc.yml +0 -9
- package/templates/gm/package.json +0 -20
- package/templates/gm/src/index.ts +0 -8
- package/templates/playground/.cursorrules +0 -290
- package/templates/playground/.env.example +0 -6
- package/templates/playground/.yarnrc.yml +0 -9
- package/templates/playground/package.json +0 -26
- package/templates/playground/src/index.ts +0 -37
- package/templates/playground/src/plugins/alchemy.ts +0 -27
- package/templates/playground/src/plugins/minilog.ts +0 -26
- package/templates/playground/src/plugins/usdc.ts +0 -99
- package/templates/playground/src/plugins/xmtp.ts +0 -137
- package/templates/playground/src/prompt.ts +0 -11
- package/templates/playground/src/skills/broadcast.ts +0 -39
- package/templates/playground/src/skills/cash.ts +0 -122
- package/templates/playground/src/skills/cryptoPrice.ts +0 -63
- package/templates/playground/src/skills/dalle.ts +0 -61
- package/templates/playground/src/skills/gated.ts +0 -88
- package/templates/playground/src/skills/search.ts +0 -159
- package/templates/playground/src/skills/todo.ts +0 -79
- package/templates/playground/src/skills/token.ts +0 -57
- package/templates/playground/src/skills/web.ts +0 -83
- package/templates/playground/src/skills/wordle.ts +0 -96
- package/templates/toss/.cursorrules +0 -290
- package/templates/toss/.env.example +0 -6
- package/templates/toss/.yarnrc.yml +0 -9
- package/templates/toss/package.json +0 -21
- package/templates/toss/src/index.ts +0 -32
- package/templates/toss/src/plugins/helpers.ts +0 -174
- package/templates/toss/src/plugins/redis.ts +0 -15
- package/templates/toss/src/prompt.ts +0 -54
- package/templates/toss/src/skills/toss.ts +0 -432
- package/templates.json +0 -58
package/README.md
CHANGED
@@ -9,13 +9,10 @@ bun create message-kit
|
|
9
9
|
```
|
10
10
|
|
11
11
|
```bash
|
12
|
-
npx create-message-kit
|
12
|
+
npx create-message-kit@latest
|
13
13
|
```
|
14
14
|
|
15
15
|
```bash
|
16
16
|
yarn create message-kit
|
17
|
-
|
18
|
-
|
19
|
-
```bash [npm]
|
20
|
-
npm init message-kit
|
17
|
+
// use yarn create message-kit@latest in yarn > v2
|
21
18
|
```
|
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.24";
|
11
11
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
12
12
|
|
13
13
|
// Read package.json to get the version
|
@@ -96,19 +96,20 @@ async function updatePackagejson(destDir, templateType) {
|
|
96
96
|
}
|
97
97
|
|
98
98
|
async function gatherProjectInfo() {
|
99
|
-
const templateOptions =
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
99
|
+
const templateOptions = [
|
100
|
+
{
|
101
|
+
value: "templates/simple",
|
102
|
+
label: "Simple - Basic template with minimal setup",
|
103
|
+
},
|
104
|
+
{
|
105
|
+
value: "templates/ens",
|
106
|
+
label: "ENS - Template with ENS integration",
|
107
|
+
},
|
108
|
+
];
|
105
109
|
|
106
110
|
const templateType = await select({
|
107
111
|
message: "Select the type of template to initialize:",
|
108
|
-
options: templateOptions
|
109
|
-
value: href,
|
110
|
-
label: `${title} - ${description}`,
|
111
|
-
})),
|
112
|
+
options: templateOptions,
|
112
113
|
});
|
113
114
|
|
114
115
|
if (isCancel(templateType)) {
|
@@ -219,8 +220,7 @@ async function detectPackageManager() {
|
|
219
220
|
|
220
221
|
const userAgent = process.env.npm_config_user_agent;
|
221
222
|
|
222
|
-
|
223
|
-
if (userAgent?.startsWith("npm")) {
|
223
|
+
if (userAgent?.startsWith("npm") || userAgent?.startsWith("npx")) {
|
224
224
|
return "npm";
|
225
225
|
}
|
226
226
|
|
@@ -286,13 +286,13 @@ ${envExampleContent}
|
|
286
286
|
3. **Install dependencies:**
|
287
287
|
|
288
288
|
\`\`\`sh
|
289
|
-
${packageManager} install
|
289
|
+
${packageManager.split("@")[0]} install
|
290
290
|
\`\`\`
|
291
291
|
|
292
292
|
4. **Run the project:**
|
293
293
|
|
294
294
|
\`\`\`sh
|
295
|
-
${packageManager
|
295
|
+
${packageManager.split("@")[0]} run dev
|
296
296
|
\`\`\`
|
297
297
|
|
298
298
|
5. Enjoy!
|
package/package.json
CHANGED
@@ -1,13 +1,12 @@
|
|
1
1
|
{
|
2
2
|
"name": "create-message-kit",
|
3
|
-
"version": "1.2.
|
3
|
+
"version": "1.2.24",
|
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
|
-
"templates.json",
|
11
10
|
"templates/**/*"
|
12
11
|
],
|
13
12
|
"scripts": {
|
@@ -112,118 +112,6 @@ export async function handler(context: XMTPContext) {
|
|
112
112
|
await context.requestPayment(amount, token, receiverAddress);
|
113
113
|
}
|
114
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
115
|
## Example final prompt
|
228
116
|
|
229
117
|
Your are a helpful and playful ens agent called @bot that lives inside a messaging app called Converse.
|
@@ -1,10 +1,4 @@
|
|
1
|
-
import {
|
2
|
-
run,
|
3
|
-
agentReply,
|
4
|
-
replaceVariables,
|
5
|
-
XMTPContext,
|
6
|
-
Agent,
|
7
|
-
} from "@xmtp/message-kit";
|
1
|
+
import { run, Agent } from "@xmtp/message-kit";
|
8
2
|
import { systemPrompt } from "./prompt.js";
|
9
3
|
import { checkDomain } from "./skills/check.js";
|
10
4
|
import { cool } from "./skills/cool.js";
|
@@ -13,41 +7,13 @@ import { register } from "./skills/register.js";
|
|
13
7
|
import { renew } from "./skills/renew.js";
|
14
8
|
import { pay } from "./skills/pay.js";
|
15
9
|
import { reset } from "./skills/reset.js";
|
16
|
-
import fs from "fs";
|
17
10
|
|
18
|
-
// [!region skills]
|
19
11
|
export const agent: Agent = {
|
20
12
|
name: "Ens Agent",
|
21
13
|
tag: "@bot",
|
22
14
|
description: "A ens agent with a lot of skills.",
|
23
|
-
skills: [
|
24
|
-
|
25
|
-
...cool,
|
26
|
-
...info,
|
27
|
-
...register,
|
28
|
-
...renew,
|
29
|
-
...reset,
|
30
|
-
...pay,
|
31
|
-
],
|
15
|
+
skills: [checkDomain, cool, info, register, renew, reset, pay],
|
16
|
+
systemPrompt: systemPrompt,
|
32
17
|
};
|
33
|
-
// [!endregion skills]
|
34
18
|
|
35
|
-
|
36
|
-
run(
|
37
|
-
async (context: XMTPContext) => {
|
38
|
-
const {
|
39
|
-
message: { sender },
|
40
|
-
agent,
|
41
|
-
} = context;
|
42
|
-
|
43
|
-
let prompt = await replaceVariables(systemPrompt, sender.address, agent);
|
44
|
-
// [!endregion run1]
|
45
|
-
//This is only used for to update the docs.
|
46
|
-
fs.writeFileSync("example_prompt.md", prompt);
|
47
|
-
// [!region run2]
|
48
|
-
await agentReply(context, prompt);
|
49
|
-
},
|
50
|
-
{ agent },
|
51
|
-
);
|
52
|
-
|
53
|
-
// [!endregion run2]
|
19
|
+
run(agent);
|
@@ -48,9 +48,12 @@ export async function handler(context: XMTPContext) {
|
|
48
48
|
message += `\n\nWould you like to tip the domain owner for getting there first 🤣?`;
|
49
49
|
message = message.trim();
|
50
50
|
|
51
|
-
|
52
|
-
|
53
|
-
|
51
|
+
const { v2, v3 } = await context.isOnXMTP(
|
52
|
+
context.client,
|
53
|
+
context.v2client,
|
54
|
+
sender?.address,
|
55
|
+
);
|
56
|
+
if (v2 || v3) {
|
54
57
|
await context.send(
|
55
58
|
`Ah, this domains is in XMTP, you can message it directly`,
|
56
59
|
);
|
@@ -112,118 +112,6 @@ export async function handler(context: XMTPContext) {
|
|
112
112
|
await context.requestPayment(amount, token, receiverAddress);
|
113
113
|
}
|
114
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
115
|
## Example final prompt
|
228
116
|
|
229
117
|
Your are a helpful and playful ens agent called @bot that lives inside a messaging app called Converse.
|
@@ -5,7 +5,6 @@ import {
|
|
5
5
|
XMTPContext,
|
6
6
|
Agent,
|
7
7
|
} from "@xmtp/message-kit";
|
8
|
-
|
9
8
|
import { systemPrompt } from "./prompt.js";
|
10
9
|
|
11
10
|
export const agent: Agent = {
|
@@ -13,13 +12,15 @@ export const agent: Agent = {
|
|
13
12
|
tag: "@bot",
|
14
13
|
description: "Use GPT to generate text responses.",
|
15
14
|
skills: [],
|
16
|
-
|
15
|
+
onMessage: async (context: XMTPContext) => {
|
16
|
+
const {
|
17
|
+
message: { sender },
|
18
|
+
agent,
|
19
|
+
} = context;
|
17
20
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
21
|
+
let prompt = await replaceVariables(systemPrompt, sender.address, agent);
|
22
|
+
await agentReply(context, prompt);
|
23
|
+
},
|
24
|
+
};
|
22
25
|
|
23
|
-
|
24
|
-
await agentReply(context, prompt);
|
25
|
-
});
|
26
|
+
run(agent);
|