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.
Files changed (75) hide show
  1. package/README.md +2 -5
  2. package/index.js +15 -15
  3. package/package.json +1 -2
  4. package/templates/ens/.cursorrules +0 -112
  5. package/templates/ens/package.json +1 -2
  6. package/templates/ens/src/index.ts +4 -38
  7. package/templates/ens/src/prompt.ts +1 -1
  8. package/templates/ens/src/skills/info.ts +6 -3
  9. package/templates/simple/.cursorrules +0 -112
  10. package/templates/simple/src/index.ts +10 -9
  11. package/templates/coinbase-agent/.cursorrules +0 -290
  12. package/templates/coinbase-agent/.env.example +0 -4
  13. package/templates/coinbase-agent/.yarnrc.yml +0 -9
  14. package/templates/coinbase-agent/package.json +0 -22
  15. package/templates/coinbase-agent/src/index.ts +0 -31
  16. package/templates/coinbase-agent/src/plugins/learnweb3.ts +0 -96
  17. package/templates/coinbase-agent/src/plugins/redis.ts +0 -15
  18. package/templates/coinbase-agent/src/prompt.ts +0 -64
  19. package/templates/coinbase-agent/src/skills/drip.ts +0 -83
  20. package/templates/coinbase-agent/src/skills/mint.ts +0 -99
  21. package/templates/coinbase-agent/src/skills/pay.ts +0 -35
  22. package/templates/coinbase-agent/src/skills/swap.ts +0 -52
  23. package/templates/faucet/.cursorrules +0 -290
  24. package/templates/faucet/.env.example +0 -5
  25. package/templates/faucet/.yarnrc.yml +0 -9
  26. package/templates/faucet/package.json +0 -22
  27. package/templates/faucet/src/index.ts +0 -39
  28. package/templates/faucet/src/plugins/learnweb3.ts +0 -96
  29. package/templates/faucet/src/plugins/redis.ts +0 -15
  30. package/templates/faucet/src/prompt.ts +0 -11
  31. package/templates/faucet/src/skills/faucet.ts +0 -140
  32. package/templates/gated-group/.cursorrules +0 -290
  33. package/templates/gated-group/.env.example +0 -3
  34. package/templates/gated-group/.yarnrc.yml +0 -9
  35. package/templates/gated-group/package.json +0 -23
  36. package/templates/gated-group/src/index.ts +0 -17
  37. package/templates/gated-group/src/plugins/alchemy.ts +0 -27
  38. package/templates/gated-group/src/plugins/xmtp.ts +0 -137
  39. package/templates/gated-group/src/prompt.ts +0 -11
  40. package/templates/gated-group/src/skills/gated.ts +0 -88
  41. package/templates/gm/.cursorrules +0 -290
  42. package/templates/gm/.env.example +0 -2
  43. package/templates/gm/.yarnrc.yml +0 -9
  44. package/templates/gm/package.json +0 -20
  45. package/templates/gm/src/index.ts +0 -8
  46. package/templates/playground/.cursorrules +0 -290
  47. package/templates/playground/.env.example +0 -6
  48. package/templates/playground/.yarnrc.yml +0 -9
  49. package/templates/playground/package.json +0 -26
  50. package/templates/playground/src/index.ts +0 -37
  51. package/templates/playground/src/plugins/alchemy.ts +0 -27
  52. package/templates/playground/src/plugins/minilog.ts +0 -26
  53. package/templates/playground/src/plugins/usdc.ts +0 -99
  54. package/templates/playground/src/plugins/xmtp.ts +0 -137
  55. package/templates/playground/src/prompt.ts +0 -11
  56. package/templates/playground/src/skills/broadcast.ts +0 -39
  57. package/templates/playground/src/skills/cash.ts +0 -122
  58. package/templates/playground/src/skills/cryptoPrice.ts +0 -63
  59. package/templates/playground/src/skills/dalle.ts +0 -61
  60. package/templates/playground/src/skills/gated.ts +0 -88
  61. package/templates/playground/src/skills/search.ts +0 -159
  62. package/templates/playground/src/skills/todo.ts +0 -79
  63. package/templates/playground/src/skills/token.ts +0 -57
  64. package/templates/playground/src/skills/web.ts +0 -83
  65. package/templates/playground/src/skills/wordle.ts +0 -96
  66. package/templates/toss/.cursorrules +0 -290
  67. package/templates/toss/.env.example +0 -6
  68. package/templates/toss/.yarnrc.yml +0 -9
  69. package/templates/toss/package.json +0 -21
  70. package/templates/toss/src/index.ts +0 -32
  71. package/templates/toss/src/plugins/helpers.ts +0 -174
  72. package/templates/toss/src/plugins/redis.ts +0 -15
  73. package/templates/toss/src/prompt.ts +0 -54
  74. package/templates/toss/src/skills/toss.ts +0 -432
  75. 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.22";
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 = fs
100
- .readJsonSync(resolve(__dirname, "./templates.json"))
101
- .filter(
102
- (template) =>
103
- template.href.includes("ens") || template.href.includes("simple"),
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.map(({ title, description, href }) => ({
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
- // Check if running through npm init
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 === "npm" ? "npm run" : packageManager} dev
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.22",
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.
@@ -8,8 +8,7 @@
8
8
  "start": "node dist/index.js"
9
9
  },
10
10
  "dependencies": {
11
- "@xmtp/message-kit": "workspace:*",
12
- "resend": "^4.0.1"
11
+ "@xmtp/message-kit": "workspace:*"
13
12
  },
14
13
  "devDependencies": {
15
14
  "@types/node": "^20.14.2",
@@ -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
- ...checkDomain,
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
- // [!region run1]
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);
@@ -1,5 +1,5 @@
1
1
  export const systemPrompt = `
2
- Your are a helpful and playful ens agent called {agent_name} that lives inside a messaging app called Converse.
2
+ {vibe}
3
3
 
4
4
  {rules}
5
5
 
@@ -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
- if (
52
- await context.isOnXMTP(context.client, context.v2client, sender?.address)
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
- run(async (context: XMTPContext) => {
19
- const {
20
- message: { sender },
21
- } = context;
21
+ let prompt = await replaceVariables(systemPrompt, sender.address, agent);
22
+ await agentReply(context, prompt);
23
+ },
24
+ };
22
25
 
23
- let prompt = await replaceVariables(systemPrompt, sender.address, agent);
24
- await agentReply(context, prompt);
25
- });
26
+ run(agent);