create-message-kit 1.2.0 → 1.2.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-message-kit",
3
- "version": "1.2.0",
3
+ "version": "1.2.2",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "main": "index.js",
@@ -9,7 +9,7 @@ export const registerSkill: Skill[] = [
9
9
  skill: "/todo",
10
10
  handler: handler,
11
11
  examples: ["/todo"],
12
- description: "Send a list of TODOs via email. Receives no parameters.",
12
+ description: "Summarize your TODOs and send an email with the summary. Receives no parameters.",
13
13
  params: {},
14
14
  },
15
15
  ];
@@ -23,7 +23,8 @@ export async function handler(context: XMTPContext) {
23
23
 
24
24
  let email = "";
25
25
 
26
- while (true) {
26
+ let intents=2
27
+ while (intents>0) {
27
28
  const emailResponse = await context.awaitResponse("Please provide your email address to receive the TODO summary:");
28
29
  email = emailResponse;
29
30
 
@@ -31,11 +32,15 @@ export async function handler(context: XMTPContext) {
31
32
  const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
32
33
  if (!emailRegex.test(email)) {
33
34
  await context.send("Invalid email format. Please try again with a valid email address.");
35
+ intents--;
34
36
  continue;
35
37
  }
36
38
  break;
37
39
  }
38
-
40
+ if(intents==0){
41
+ await context.send("I couldn't get your email address. Please try again later.");
42
+ return;
43
+ }
39
44
  try {
40
45
  let content={
41
46
  from: 'onboarding@resend.dev',
@@ -47,8 +52,8 @@ export async function handler(context: XMTPContext) {
47
52
  `
48
53
  }
49
54
  console.log(content);
50
- const response = await resend.emails.send(content);
51
- console.log(response);
55
+ // const response = await resend.emails.send(content);
56
+ // console.log(response);
52
57
 
53
58
  await context.send(`✅ Summary sent successfully to ${email}`);
54
59
  } catch (error) {
@@ -56,7 +56,7 @@ run(
56
56
  // [!region run2]
57
57
  await agentReply(context, prompt);
58
58
  },
59
- { agent },
59
+ { agent},
60
60
  );
61
61
 
62
62
  // [!endregion run2]
@@ -9,7 +9,7 @@ Your are helpful and playful web3 agent called {agent_name} that lives inside a
9
9
 
10
10
  ## Common Issues
11
11
  1. Missing commands in responses
12
- **Issue**: Sometimes responses about registered domains are sent without the required command.
12
+ **Issue**: Sometimes responses are sent without the required command.
13
13
  **Example**:
14
14
  Incorrect:
15
15
  > "Looks like vitalik.eth is registered! What about these cool alternatives?"
@@ -42,7 +42,7 @@ async function createGroup(
42
42
  clientAddress: string,
43
43
  ) {
44
44
  let senderInboxId = "";
45
- const group = await client?.conversations.newConversation([
45
+ const group = await client?.conversations.newGroup([
46
46
  senderAddress,
47
47
  clientAddress,
48
48
  ]);