create-message-kit 1.2.32 → 1.2.35

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/index.js CHANGED
@@ -7,7 +7,6 @@ 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.32";
11
10
  const __dirname = dirname(fileURLToPath(import.meta.url));
12
11
 
13
12
  // Read package.json to get the version
@@ -26,13 +25,7 @@ program
26
25
  log.info(pc.cyan(`pkgManager detected: ${pkgManager}`));
27
26
 
28
27
  log.info(pc.cyan(`Welcome to MessageKit CLI v${version}!`));
29
- if (version !== defVersion) {
30
- log.warn(
31
- pc.red(
32
- "You are using a version of the CLI that is not compatible with the latest MessageKit. Please update to the latest version.",
33
- ),
34
- );
35
- }
28
+
36
29
  const coolLogo = `
37
30
  ███╗ ███╗███████╗███████╗███████╗ █████╗ ██████╗ ███████╗██╗ ██╗██╗████████╗
38
31
  ████╗ ████║██╔════╝██╔════╝██╔════╝██╔══██╗██╔════╝ ██╔════╝██║ ██╔╝██║╚══██╔══╝
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-message-kit",
3
- "version": "1.2.32",
3
+ "version": "1.2.35",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "main": "index.js",
@@ -1,209 +0,0 @@
1
- # MessageKit
2
-
3
- # Skill Examples
4
-
5
- ### Check if a Domain is Available
6
-
7
-
8
- import { ensUrl } from "../index.js";
9
- import { Context } 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: Context) {
29
- const {
30
- message: {
31
- content: {
32
- params: { domain },
33
- },
34
- },
35
- } = context;
36
-
37
- const data = await 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 { Context } 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: Context) {
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 getUserInfo(username))?.address;
106
- }
107
- if (address) {
108
- // Prioritize address over username
109
- receiverAddress = address;
110
- }
111
-
112
- await context.framekit.requestPayment(receiverAddress, amount, token);
113
- }
114
-
115
-
116
- # Docs
117
-
118
- # Structure
119
-
120
- ## File structure
121
-
122
- Each app consists of the following files:
123
-
124
- ```
125
- agent/
126
- ├── src/
127
- │ └── index.ts
128
- │ └── prompt.ts # Optional
129
- │ └── plugins/ # Optional
130
- │ └── ...
131
- │ └── skills/ # Optional
132
- │ └── ...
133
- │ └── vibes/ # Optional
134
- │ └── ...
135
- ├── tsconfig.json
136
- ├── package.json
137
- └── .env
138
- ```
139
-
140
- ## Agent
141
-
142
- This is the main function that runs the listener.
143
-
144
- ```jsx
145
- import { Agent, run, Context } from "@xmtp/message-kit";
146
-
147
- const agent: Agent = {
148
- name: "Agent Name",
149
- tag: "@bot",
150
- description: "Agent Description",
151
- skills: [skill1, skill2],
152
- onMessage: async (context: Context) => {
153
- /* Logs every message in a conversation.
154
- If not declared, the agent will automatically use the defined skills.
155
- Alternatively, you can implement your own logic here. */
156
- },
157
- config: {
158
- // Optional parameters
159
- },
160
- };
161
- //starts the agent
162
- run(agent);
163
- ```
164
-
165
- #### Config parameters
166
-
167
- - `privateKey`: the private key of the agent wallet, like any normal wallet private key.
168
- - `experimental`: experimental features like logging all group messages. Default is `false`.
169
- - `attachments`: to receive attachments. Default is `false`.
170
- - `gptModel`: model to be used. Default is `gpt-4o`.
171
- - `client`: Optional parameters to pass to the XMTP client.
172
- - `agent`: Custom agent to be used. Default is to create the skills in the `src/skills.ts` file.
173
- - `hideInitLogMessage`: hide the init log message with messagekit logo and stuff
174
- - `memberChange`: if true, member changes will be enabled, like adding members to the group
175
-
176
- ## Skills
177
-
178
- Skills are the actions of the agent. They are defined in the `src/skills/your-skill.ts` file.
179
-
180
- ```tsx
181
- import { Skill } from "@xmtp/message-kit";
182
-
183
- export const checkDomain: Skill[] = [
184
- {
185
- skill: // name of the skill
186
- handler: // function to handle the skill
187
- examples: // examples of the skill
188
- description: // description of the skill
189
- params: // params of the skill
190
- },
191
- ];
192
- ```
193
-
194
- ## Vibes
195
-
196
- Vibes are the personalities of the agent. They are defined in the `src/vibes/your-vibe.ts` file.
197
-
198
- ```tsx
199
- import { Vibe } from "@xmtp/message-kit";
200
-
201
- export const chill: Vibe = {
202
- vibe: // name of the vibe
203
- description: // description of the vibe
204
- tone: // tone of the vibe
205
- style: // style of the vibe
206
- };
207
- ```
208
-
209
- > See [Vibes](/community/vibes) for more information.
@@ -1,4 +1,4 @@
1
- import { run, Agent } from "@xmtp/message-kit";
1
+ import { createAgent } from "@xmtp/message-kit";
2
2
  import { checkDomain } from "./skills/check.js";
3
3
  import { cool } from "./skills/cool.js";
4
4
  import { info } from "./skills/info.js";
@@ -6,11 +6,9 @@ import { register } from "./skills/register.js";
6
6
  import { renew } from "./skills/renew.js";
7
7
  import { pay } from "./skills/pay.js";
8
8
 
9
- export const agent: Agent = {
9
+ export const agent = createAgent({
10
10
  name: "Ens Agent",
11
11
  tag: "@bot",
12
12
  description: "A ens agent with a lot of skills.",
13
13
  skills: [checkDomain, cool, info, register, renew, pay],
14
- };
15
-
16
- run(agent);
14
+ }).run();
@@ -1,4 +1,4 @@
1
- import { Context, getUserInfo, Skill } from "@xmtp/message-kit";
1
+ import { Context, FrameKit, getUserInfo, Skill } from "@xmtp/message-kit";
2
2
 
3
3
  export const pay: Skill[] = [
4
4
  {
@@ -24,10 +24,6 @@ export const pay: Skill[] = [
24
24
  default: "",
25
25
  type: "username",
26
26
  },
27
- address: {
28
- default: "",
29
- type: "address",
30
- },
31
27
  },
32
28
  },
33
29
  {
@@ -48,22 +44,17 @@ export async function handler(context: Context) {
48
44
  message: {
49
45
  content: {
50
46
  skill,
51
- params: { amount, token, username, address },
47
+ params: { amount, token, username },
52
48
  },
53
49
  },
54
50
  } = context;
55
- let receiverAddress = address;
56
- if (username) {
57
- receiverAddress = (await getUserInfo(username))?.address;
58
- }
59
- if (address) {
60
- //Prioritize address over username
61
- receiverAddress = address;
62
- }
51
+ let receiverAddress = username?.address;
63
52
  if (skill === "tip") {
64
53
  let tipAmount = 1;
65
- await context.framekit.requestPayment(receiverAddress, tipAmount);
54
+ const url = await FrameKit.requestPayment(receiverAddress, tipAmount);
55
+ await context.dm(url);
66
56
  } else if (skill === "pay") {
67
- await context.framekit.requestPayment(receiverAddress, amount, token);
57
+ const url = await FrameKit.requestPayment(receiverAddress, amount, token);
58
+ await context.dm(url);
68
59
  }
69
60
  }
@@ -1,209 +0,0 @@
1
- # MessageKit
2
-
3
- # Skill Examples
4
-
5
- ### Check if a Domain is Available
6
-
7
-
8
- import { ensUrl } from "../index.js";
9
- import { Context } 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: Context) {
29
- const {
30
- message: {
31
- content: {
32
- params: { domain },
33
- },
34
- },
35
- } = context;
36
-
37
- const data = await 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 { Context } 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: Context) {
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 getUserInfo(username))?.address;
106
- }
107
- if (address) {
108
- // Prioritize address over username
109
- receiverAddress = address;
110
- }
111
-
112
- await context.framekit.requestPayment(receiverAddress, amount, token);
113
- }
114
-
115
-
116
- # Docs
117
-
118
- # Structure
119
-
120
- ## File structure
121
-
122
- Each app consists of the following files:
123
-
124
- ```
125
- agent/
126
- ├── src/
127
- │ └── index.ts
128
- │ └── prompt.ts # Optional
129
- │ └── plugins/ # Optional
130
- │ └── ...
131
- │ └── skills/ # Optional
132
- │ └── ...
133
- │ └── vibes/ # Optional
134
- │ └── ...
135
- ├── tsconfig.json
136
- ├── package.json
137
- └── .env
138
- ```
139
-
140
- ## Agent
141
-
142
- This is the main function that runs the listener.
143
-
144
- ```jsx
145
- import { Agent, run, Context } from "@xmtp/message-kit";
146
-
147
- const agent: Agent = {
148
- name: "Agent Name",
149
- tag: "@bot",
150
- description: "Agent Description",
151
- skills: [skill1, skill2],
152
- onMessage: async (context: Context) => {
153
- /* Logs every message in a conversation.
154
- If not declared, the agent will automatically use the defined skills.
155
- Alternatively, you can implement your own logic here. */
156
- },
157
- config: {
158
- // Optional parameters
159
- },
160
- };
161
- //starts the agent
162
- run(agent);
163
- ```
164
-
165
- #### Config parameters
166
-
167
- - `privateKey`: the private key of the agent wallet, like any normal wallet private key.
168
- - `experimental`: experimental features like logging all group messages. Default is `false`.
169
- - `attachments`: to receive attachments. Default is `false`.
170
- - `gptModel`: model to be used. Default is `gpt-4o`.
171
- - `client`: Optional parameters to pass to the XMTP client.
172
- - `agent`: Custom agent to be used. Default is to create the skills in the `src/skills.ts` file.
173
- - `hideInitLogMessage`: hide the init log message with messagekit logo and stuff
174
- - `memberChange`: if true, member changes will be enabled, like adding members to the group
175
-
176
- ## Skills
177
-
178
- Skills are the actions of the agent. They are defined in the `src/skills/your-skill.ts` file.
179
-
180
- ```tsx
181
- import { Skill } from "@xmtp/message-kit";
182
-
183
- export const checkDomain: Skill[] = [
184
- {
185
- skill: // name of the skill
186
- handler: // function to handle the skill
187
- examples: // examples of the skill
188
- description: // description of the skill
189
- params: // params of the skill
190
- },
191
- ];
192
- ```
193
-
194
- ## Vibes
195
-
196
- Vibes are the personalities of the agent. They are defined in the `src/vibes/your-vibe.ts` file.
197
-
198
- ```tsx
199
- import { Vibe } from "@xmtp/message-kit";
200
-
201
- export const chill: Vibe = {
202
- vibe: // name of the vibe
203
- description: // description of the vibe
204
- tone: // tone of the vibe
205
- style: // style of the vibe
206
- };
207
- ```
208
-
209
- > See [Vibes](/community/vibes) for more information.
@@ -1,7 +1,7 @@
1
- import { run, Agent, concierge } from "@xmtp/message-kit";
1
+ import { concierge, createAgent } from "@xmtp/message-kit";
2
2
  import { degen } from "./vibes/degen.js";
3
3
 
4
- const agent: Agent = {
4
+ export const agent = createAgent({
5
5
  name: "Human Agent",
6
6
  tag: "@bot",
7
7
  description: "An agent that performs payments and transfers in usdc. .",
@@ -12,6 +12,4 @@ const agent: Agent = {
12
12
  config: {
13
13
  walletService: true,
14
14
  },
15
- };
16
-
17
- run(agent);
15
+ }).run();
@@ -1,209 +0,0 @@
1
- # MessageKit
2
-
3
- # Skill Examples
4
-
5
- ### Check if a Domain is Available
6
-
7
-
8
- import { ensUrl } from "../index.js";
9
- import { Context } 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: Context) {
29
- const {
30
- message: {
31
- content: {
32
- params: { domain },
33
- },
34
- },
35
- } = context;
36
-
37
- const data = await 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 { Context } 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: Context) {
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 getUserInfo(username))?.address;
106
- }
107
- if (address) {
108
- // Prioritize address over username
109
- receiverAddress = address;
110
- }
111
-
112
- await context.framekit.requestPayment(receiverAddress, amount, token);
113
- }
114
-
115
-
116
- # Docs
117
-
118
- # Structure
119
-
120
- ## File structure
121
-
122
- Each app consists of the following files:
123
-
124
- ```
125
- agent/
126
- ├── src/
127
- │ └── index.ts
128
- │ └── prompt.ts # Optional
129
- │ └── plugins/ # Optional
130
- │ └── ...
131
- │ └── skills/ # Optional
132
- │ └── ...
133
- │ └── vibes/ # Optional
134
- │ └── ...
135
- ├── tsconfig.json
136
- ├── package.json
137
- └── .env
138
- ```
139
-
140
- ## Agent
141
-
142
- This is the main function that runs the listener.
143
-
144
- ```jsx
145
- import { Agent, run, Context } from "@xmtp/message-kit";
146
-
147
- const agent: Agent = {
148
- name: "Agent Name",
149
- tag: "@bot",
150
- description: "Agent Description",
151
- skills: [skill1, skill2],
152
- onMessage: async (context: Context) => {
153
- /* Logs every message in a conversation.
154
- If not declared, the agent will automatically use the defined skills.
155
- Alternatively, you can implement your own logic here. */
156
- },
157
- config: {
158
- // Optional parameters
159
- },
160
- };
161
- //starts the agent
162
- run(agent);
163
- ```
164
-
165
- #### Config parameters
166
-
167
- - `privateKey`: the private key of the agent wallet, like any normal wallet private key.
168
- - `experimental`: experimental features like logging all group messages. Default is `false`.
169
- - `attachments`: to receive attachments. Default is `false`.
170
- - `gptModel`: model to be used. Default is `gpt-4o`.
171
- - `client`: Optional parameters to pass to the XMTP client.
172
- - `agent`: Custom agent to be used. Default is to create the skills in the `src/skills.ts` file.
173
- - `hideInitLogMessage`: hide the init log message with messagekit logo and stuff
174
- - `memberChange`: if true, member changes will be enabled, like adding members to the group
175
-
176
- ## Skills
177
-
178
- Skills are the actions of the agent. They are defined in the `src/skills/your-skill.ts` file.
179
-
180
- ```tsx
181
- import { Skill } from "@xmtp/message-kit";
182
-
183
- export const checkDomain: Skill[] = [
184
- {
185
- skill: // name of the skill
186
- handler: // function to handle the skill
187
- examples: // examples of the skill
188
- description: // description of the skill
189
- params: // params of the skill
190
- },
191
- ];
192
- ```
193
-
194
- ## Vibes
195
-
196
- Vibes are the personalities of the agent. They are defined in the `src/vibes/your-vibe.ts` file.
197
-
198
- ```tsx
199
- import { Vibe } from "@xmtp/message-kit";
200
-
201
- export const chill: Vibe = {
202
- vibe: // name of the vibe
203
- description: // description of the vibe
204
- tone: // tone of the vibe
205
- style: // style of the vibe
206
- };
207
- ```
208
-
209
- > See [Vibes](/community/vibes) for more information.
@@ -1,7 +1,7 @@
1
1
  // [!region index]
2
- import { run, agentReply, Context, Agent } from "@xmtp/message-kit";
2
+ import { agentReply, Context, createAgent } from "@xmtp/message-kit";
3
3
 
4
- export const agent: Agent = {
4
+ export const agent = createAgent({
5
5
  name: "GPT Bot",
6
6
  description: "Use GPT to generate text responses.",
7
7
  tag: "@bot",
@@ -10,7 +10,5 @@ export const agent: Agent = {
10
10
  await agentReply(context);
11
11
  // [!region final]
12
12
  },
13
- };
14
-
15
- run(agent);
13
+ }).run();
16
14
  // [!endregion final]