create-message-kit 1.2.26 → 1.2.29

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,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.26";
10
+ const defVersion = "1.2.29";
11
11
  const __dirname = dirname(fileURLToPath(import.meta.url));
12
12
 
13
13
  // Read package.json to get the version
@@ -49,6 +49,8 @@ Powered by XMTP`;
49
49
  // Create .gitignore
50
50
  createGitignore(destDir);
51
51
 
52
+ // Create .data directory
53
+ createDataDir(destDir);
52
54
  // Create .env file
53
55
  createEnvFile(destDir);
54
56
 
@@ -77,6 +79,12 @@ Powered by XMTP`;
77
79
 
78
80
  program.parse(process.argv);
79
81
 
82
+ async function createDataDir(destDir) {
83
+ if (!fs.existsSync(resolve(destDir, ".data"))) {
84
+ fs.mkdirSync(resolve(destDir, ".data"));
85
+ }
86
+ }
87
+
80
88
  async function updatePackagejson(destDir, templateType) {
81
89
  // Remove 'templates/' prefix if it exists in templateType
82
90
  const cleanTemplatePath = templateType.replace("templates/", "");
@@ -105,6 +113,10 @@ async function gatherProjectInfo() {
105
113
  value: "templates/ens",
106
114
  label: "ENS - Template with ENS integration",
107
115
  },
116
+ {
117
+ value: "templates/paymentagent",
118
+ label: "Payment Agent - Template for funding an agent wallet",
119
+ },
108
120
  ];
109
121
 
110
122
  const templateType = await select({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-message-kit",
3
- "version": "1.2.26",
3
+ "version": "1.2.29",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "main": "index.js",
@@ -6,7 +6,7 @@
6
6
 
7
7
 
8
8
  import { ensUrl } from "../index.js";
9
- import { XMTPContext } from "@xmtp/message-kit";
9
+ import { Context } from "@xmtp/message-kit";
10
10
  import type { Skill } from "@xmtp/message-kit";
11
11
 
12
12
  // Define Skill
@@ -25,7 +25,7 @@ export const checkDomain: Skill[] = [
25
25
  ];
26
26
 
27
27
  // Handler Implementation
28
- export async function handler(context: XMTPContext) {
28
+ export async function handler(context: Context) {
29
29
  const {
30
30
  message: {
31
31
  content: {
@@ -34,7 +34,7 @@ export async function handler(context: XMTPContext) {
34
34
  },
35
35
  } = context;
36
36
 
37
- const data = await context.getUserInfo(domain);
37
+ const data = await getUserInfo(domain);
38
38
 
39
39
  if (!data?.address) {
40
40
  let message = `Looks like ${domain} is available! Here you can register it: ${ensUrl}${domain} or would you like to see some cool alternatives?`;
@@ -55,7 +55,7 @@ export async function handler(context: XMTPContext) {
55
55
  ### Generate a payment request
56
56
 
57
57
 
58
- import { XMTPContext } from "@xmtp/message-kit";
58
+ import { Context } from "@xmtp/message-kit";
59
59
  import type { Skill } from "@xmtp/message-kit";
60
60
 
61
61
  // Define Skill
@@ -92,7 +92,7 @@ export const paymentRequest: Skill[] = [
92
92
  ];
93
93
 
94
94
  // Handler Implementation
95
- export async function handler(context: XMTPContext) {
95
+ export async function handler(context: Context) {
96
96
  const {
97
97
  message: {
98
98
  content: {
@@ -102,14 +102,14 @@ export async function handler(context: XMTPContext) {
102
102
  } = context;
103
103
  let receiverAddress = address;
104
104
  if (username) {
105
- receiverAddress = (await context.getUserInfo(username))?.address;
105
+ receiverAddress = (await getUserInfo(username))?.address;
106
106
  }
107
107
  if (address) {
108
108
  // Prioritize address over username
109
109
  receiverAddress = address;
110
110
  }
111
111
 
112
- await context.requestPayment(receiverAddress, amount, token);
112
+ await context.framekit.requestPayment(receiverAddress, amount, token);
113
113
  }
114
114
 
115
115
 
@@ -125,12 +125,12 @@ Each app consists of the following files:
125
125
  agent/
126
126
  ├── src/
127
127
  │ └── index.ts
128
- │ └── prompt.ts
129
- │ └── plugins/
128
+ │ └── prompt.ts # Optional
129
+ │ └── plugins/ # Optional
130
130
  │ └── ...
131
- │ └── skills/
131
+ │ └── skills/ # Optional
132
132
  │ └── ...
133
- │ └── vibes/
133
+ │ └── vibes/ # Optional
134
134
  │ └── ...
135
135
  ├── tsconfig.json
136
136
  ├── package.json
@@ -142,14 +142,14 @@ agent/
142
142
  This is the main function that runs the listener.
143
143
 
144
144
  ```jsx
145
- import { Agent, run, XMTPContext } from "@xmtp/message-kit";
145
+ import { Agent, run, Context } from "@xmtp/message-kit";
146
146
 
147
147
  const agent: Agent = {
148
148
  name: "Agent Name",
149
149
  tag: "@bot",
150
150
  description: "Agent Description",
151
151
  skills: [skill1, skill2],
152
- onMessage: async (context: XMTPContext) => {
152
+ onMessage: async (context: Context) => {
153
153
  /* Logs every message in a conversation.
154
154
  If not declared, the agent will automatically use the defined skills.
155
155
  Alternatively, you can implement your own logic here. */
@@ -1,5 +1,4 @@
1
1
  import { run, Agent } from "@xmtp/message-kit";
2
- import { systemPrompt } from "./prompt.js";
3
2
  import { checkDomain } from "./skills/check.js";
4
3
  import { cool } from "./skills/cool.js";
5
4
  import { info } from "./skills/info.js";
@@ -12,7 +11,6 @@ export const agent: Agent = {
12
11
  tag: "@bot",
13
12
  description: "A ens agent with a lot of skills.",
14
13
  skills: [checkDomain, cool, info, register, renew, pay],
15
- systemPrompt: systemPrompt,
16
14
  };
17
15
 
18
16
  run(agent);
@@ -1,5 +1,4 @@
1
- import { XMTPContext } from "@xmtp/message-kit";
2
- import type { Skill } from "@xmtp/message-kit";
1
+ import { Context, getUserInfo, Skill } from "@xmtp/message-kit";
3
2
 
4
3
  const ensUrl = "https://app.ens.domains/";
5
4
 
@@ -20,7 +19,7 @@ export const checkDomain: Skill[] = [
20
19
  // [!endregion define]
21
20
 
22
21
  // [!region handle]
23
- export async function handler(context: XMTPContext) {
22
+ export async function handler(context: Context) {
24
23
  const {
25
24
  message: {
26
25
  content: {
@@ -29,7 +28,7 @@ export async function handler(context: XMTPContext) {
29
28
  },
30
29
  } = context;
31
30
 
32
- const data = await context.getUserInfo(domain);
31
+ const data = await getUserInfo(domain);
33
32
 
34
33
  if (!data?.address) {
35
34
  let message = `Looks like ${domain} is available! Here you can register it: ${ensUrl}${domain} or would you like to see some cool alternatives?`;
@@ -1,4 +1,4 @@
1
- import { XMTPContext } from "@xmtp/message-kit";
1
+ import { Context } from "@xmtp/message-kit";
2
2
 
3
3
  import type { Skill } from "@xmtp/message-kit";
4
4
 
@@ -15,7 +15,7 @@ export const cool: Skill[] = [
15
15
  },
16
16
  },
17
17
  ];
18
- export async function handler(context: XMTPContext) {
18
+ export async function handler(context: Context) {
19
19
  const {
20
20
  message: {
21
21
  content: {
@@ -1,6 +1,4 @@
1
- import { XMTPContext } from "@xmtp/message-kit";
2
-
3
- import type { Skill } from "@xmtp/message-kit";
1
+ import { Context, getUserInfo, Skill } from "@xmtp/message-kit";
4
2
 
5
3
  // [!region define]
6
4
  export const info: Skill[] = [
@@ -26,7 +24,7 @@ export const info: Skill[] = [
26
24
  // [!endregion define]
27
25
 
28
26
  // [!region handle]
29
- export async function handler(context: XMTPContext) {
27
+ export async function handler(context: Context) {
30
28
  const {
31
29
  message: {
32
30
  sender,
@@ -36,7 +34,7 @@ export async function handler(context: XMTPContext) {
36
34
  },
37
35
  } = context;
38
36
 
39
- const data = await context.getUserInfo(domain);
37
+ const data = await getUserInfo(domain);
40
38
  if (!data?.address) {
41
39
  return {
42
40
  code: 404,
@@ -1,5 +1,4 @@
1
- import { XMTPContext } from "@xmtp/message-kit";
2
- import type { Skill } from "@xmtp/message-kit";
1
+ import { Context, getUserInfo, Skill } from "@xmtp/message-kit";
3
2
 
4
3
  export const pay: Skill[] = [
5
4
  {
@@ -44,7 +43,7 @@ export const pay: Skill[] = [
44
43
  },
45
44
  },
46
45
  ];
47
- export async function handler(context: XMTPContext) {
46
+ export async function handler(context: Context) {
48
47
  const {
49
48
  message: {
50
49
  content: {
@@ -55,7 +54,7 @@ export async function handler(context: XMTPContext) {
55
54
  } = context;
56
55
  let receiverAddress = address;
57
56
  if (username) {
58
- receiverAddress = (await context.getUserInfo(username))?.address;
57
+ receiverAddress = (await getUserInfo(username))?.address;
59
58
  }
60
59
  if (address) {
61
60
  //Prioritize address over username
@@ -63,10 +62,8 @@ export async function handler(context: XMTPContext) {
63
62
  }
64
63
  if (skill === "tip") {
65
64
  let tipAmount = 1;
66
- await context.send("Sure, here is the tip link: ");
67
- await context.requestPayment(receiverAddress, tipAmount);
65
+ await context.framekit.requestPayment(receiverAddress, tipAmount);
68
66
  } else if (skill === "pay") {
69
- await context.send("Sure, here is the payment link: ");
70
- await context.requestPayment(receiverAddress, amount, token);
67
+ await context.framekit.requestPayment(receiverAddress, amount, token);
71
68
  }
72
69
  }
@@ -1,4 +1,4 @@
1
- import { XMTPContext } from "@xmtp/message-kit";
1
+ import { Context } from "@xmtp/message-kit";
2
2
 
3
3
  const ensUrl = "https://app.ens.domains/";
4
4
  import type { Skill } from "@xmtp/message-kit";
@@ -18,7 +18,7 @@ export const register: Skill[] = [
18
18
  },
19
19
  ];
20
20
 
21
- export async function handler(context: XMTPContext) {
21
+ export async function handler(context: Context) {
22
22
  const {
23
23
  message: {
24
24
  content: {
@@ -1,6 +1,4 @@
1
- import { XMTPContext } from "@xmtp/message-kit";
2
-
3
- import type { Skill } from "@xmtp/message-kit";
1
+ import { Context, getUserInfo, Skill } from "@xmtp/message-kit";
4
2
 
5
3
  const frameUrl = "https://ens.steer.fun/";
6
4
 
@@ -19,7 +17,7 @@ export const renew: Skill[] = [
19
17
  },
20
18
  ];
21
19
 
22
- export async function handler(context: XMTPContext) {
20
+ export async function handler(context: Context) {
23
21
  const {
24
22
  message: {
25
23
  sender,
@@ -37,7 +35,7 @@ export async function handler(context: XMTPContext) {
37
35
  };
38
36
  }
39
37
 
40
- const data = await context.getUserInfo(domain);
38
+ const data = await getUserInfo(domain);
41
39
 
42
40
  if (!data?.address || data?.address !== sender?.address) {
43
41
  return {
@@ -0,0 +1,209 @@
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.
@@ -0,0 +1,2 @@
1
+ KEY= # the private key of the agent wallet
2
+ TEST_ENCRYPTION_KEY= # a different private key for encryption
@@ -0,0 +1,9 @@
1
+ compressionLevel: mixed
2
+
3
+ enableGlobalCache: false
4
+
5
+ enableTelemetry: false
6
+
7
+ nodeLinker: node-modules
8
+
9
+ yarnPath: .yarn/releases/yarn-4.5.1.cjs
@@ -0,0 +1,21 @@
1
+ {
2
+ "name": "paymentagent",
3
+ "private": true,
4
+ "description": "A human agent for managing your funds",
5
+ "type": "module",
6
+ "scripts": {
7
+ "build": "tsc",
8
+ "dev": "tsc -w & sleep 1 && NODE_NO_WARNINGS=1 node --watch dist/index.js",
9
+ "start": "node dist/index.js"
10
+ },
11
+ "dependencies": {
12
+ "@xmtp/message-kit": "workspace:*"
13
+ },
14
+ "devDependencies": {
15
+ "@types/node": "^20.14.2",
16
+ "typescript": "^5.4.5"
17
+ },
18
+ "engines": {
19
+ "node": ">=20"
20
+ }
21
+ }
@@ -0,0 +1,19 @@
1
+ import { run, Agent, concierge } from "@xmtp/message-kit";
2
+ import { degen } from "./vibes/degen.js";
3
+ import { systemPrompt } from "./prompt.js";
4
+
5
+ const agent: Agent = {
6
+ name: "Human Agent",
7
+ tag: "@bot",
8
+ description: "An agent that performs payments and transfers in usdc. .",
9
+ intro:
10
+ "You are a helpful agent called {agent_name} that helps people with their agent wallets. You can help them fund their wallets, check their balance and making transfers. All in usdc.",
11
+ vibe: degen,
12
+ systemPrompt,
13
+ skills: [concierge],
14
+ config: {
15
+ walletService: true,
16
+ },
17
+ };
18
+
19
+ run(agent);
@@ -1,4 +1,5 @@
1
- export const systemPrompt = `
1
+ export const systemPrompt = `{intro}
2
+
2
3
  {vibe}
3
4
 
4
5
  {rules}
@@ -6,6 +7,4 @@ export const systemPrompt = `
6
7
  {user_context}
7
8
 
8
9
  {skills}
9
-
10
- {issues}
11
10
  `;
@@ -0,0 +1,10 @@
1
+ import { Vibe } from "@xmtp/message-kit";
2
+
3
+ export const degen: Vibe = {
4
+ vibe: "Degen",
5
+ description:
6
+ "A high-energy, risk-embracing personality from the crypto trading world. This vibe combines technical knowledge with meme culture, FOMO-driven enthusiasm, and an 'apes together strong' mentality. Always bullish, never sleeping, and ready to APE into the next big thing.",
7
+ tone: "enthusiastic and bold, like a trader who just discovered a 100x gem at 3AM",
8
+ style:
9
+ "casual and meme-heavy, peppered with crypto slang like 'gm', 'wagmi', and 'probably nothing', while maintaining genuine helpfulness",
10
+ };
@@ -6,7 +6,7 @@
6
6
 
7
7
 
8
8
  import { ensUrl } from "../index.js";
9
- import { XMTPContext } from "@xmtp/message-kit";
9
+ import { Context } from "@xmtp/message-kit";
10
10
  import type { Skill } from "@xmtp/message-kit";
11
11
 
12
12
  // Define Skill
@@ -25,7 +25,7 @@ export const checkDomain: Skill[] = [
25
25
  ];
26
26
 
27
27
  // Handler Implementation
28
- export async function handler(context: XMTPContext) {
28
+ export async function handler(context: Context) {
29
29
  const {
30
30
  message: {
31
31
  content: {
@@ -34,7 +34,7 @@ export async function handler(context: XMTPContext) {
34
34
  },
35
35
  } = context;
36
36
 
37
- const data = await context.getUserInfo(domain);
37
+ const data = await getUserInfo(domain);
38
38
 
39
39
  if (!data?.address) {
40
40
  let message = `Looks like ${domain} is available! Here you can register it: ${ensUrl}${domain} or would you like to see some cool alternatives?`;
@@ -55,7 +55,7 @@ export async function handler(context: XMTPContext) {
55
55
  ### Generate a payment request
56
56
 
57
57
 
58
- import { XMTPContext } from "@xmtp/message-kit";
58
+ import { Context } from "@xmtp/message-kit";
59
59
  import type { Skill } from "@xmtp/message-kit";
60
60
 
61
61
  // Define Skill
@@ -92,7 +92,7 @@ export const paymentRequest: Skill[] = [
92
92
  ];
93
93
 
94
94
  // Handler Implementation
95
- export async function handler(context: XMTPContext) {
95
+ export async function handler(context: Context) {
96
96
  const {
97
97
  message: {
98
98
  content: {
@@ -102,14 +102,14 @@ export async function handler(context: XMTPContext) {
102
102
  } = context;
103
103
  let receiverAddress = address;
104
104
  if (username) {
105
- receiverAddress = (await context.getUserInfo(username))?.address;
105
+ receiverAddress = (await getUserInfo(username))?.address;
106
106
  }
107
107
  if (address) {
108
108
  // Prioritize address over username
109
109
  receiverAddress = address;
110
110
  }
111
111
 
112
- await context.requestPayment(receiverAddress, amount, token);
112
+ await context.framekit.requestPayment(receiverAddress, amount, token);
113
113
  }
114
114
 
115
115
 
@@ -125,12 +125,12 @@ Each app consists of the following files:
125
125
  agent/
126
126
  ├── src/
127
127
  │ └── index.ts
128
- │ └── prompt.ts
129
- │ └── plugins/
128
+ │ └── prompt.ts # Optional
129
+ │ └── plugins/ # Optional
130
130
  │ └── ...
131
- │ └── skills/
131
+ │ └── skills/ # Optional
132
132
  │ └── ...
133
- │ └── vibes/
133
+ │ └── vibes/ # Optional
134
134
  │ └── ...
135
135
  ├── tsconfig.json
136
136
  ├── package.json
@@ -142,14 +142,14 @@ agent/
142
142
  This is the main function that runs the listener.
143
143
 
144
144
  ```jsx
145
- import { Agent, run, XMTPContext } from "@xmtp/message-kit";
145
+ import { Agent, run, Context } from "@xmtp/message-kit";
146
146
 
147
147
  const agent: Agent = {
148
148
  name: "Agent Name",
149
149
  tag: "@bot",
150
150
  description: "Agent Description",
151
151
  skills: [skill1, skill2],
152
- onMessage: async (context: XMTPContext) => {
152
+ onMessage: async (context: Context) => {
153
153
  /* Logs every message in a conversation.
154
154
  If not declared, the agent will automatically use the defined skills.
155
155
  Alternatively, you can implement your own logic here. */
@@ -1,30 +1,13 @@
1
1
  // [!region index]
2
- import {
3
- run,
4
- agentReply,
5
- parsePrompt,
6
- XMTPContext,
7
- Agent,
8
- } from "@xmtp/message-kit";
9
- import { systemPrompt } from "./prompt.js";
2
+ import { run, agentReply, Context, Agent } from "@xmtp/message-kit";
10
3
 
11
4
  export const agent: Agent = {
12
5
  name: "GPT Bot",
13
- tag: "@bot",
14
6
  description: "Use GPT to generate text responses.",
15
- onMessage: async (context: XMTPContext) => {
16
- const {
17
- message: {
18
- sender,
19
- content: { text },
20
- },
21
- agent,
22
- } = context;
7
+ tag: "@bot",
8
+ onMessage: async (context: Context) => {
23
9
  // [!endregion index]
24
-
25
- let prompt = await parsePrompt(systemPrompt, sender.address, agent);
26
- await agentReply(context, prompt);
27
-
10
+ await agentReply(context);
28
11
  // [!region final]
29
12
  },
30
13
  };
@@ -1,9 +0,0 @@
1
- export const systemPrompt = `
2
- You are a helpful and playful agent called {agent_name} that lives inside a web3 messaging app called Converse.
3
-
4
- {rules}
5
-
6
- {user_context}
7
-
8
- {issues}
9
- `;