create-message-kit 1.1.7-beta.4 → 1.1.7-beta.5

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-message-kit",
3
- "version": "1.1.7-beta.4",
3
+ "version": "1.1.7-beta.5",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "main": "index.js",
@@ -14,7 +14,6 @@ export async function handleEns(
14
14
  message: {
15
15
  content: { command, params, sender },
16
16
  },
17
- skill,
18
17
  } = context;
19
18
  if (command == "reset") {
20
19
  clearMemory();
@@ -118,7 +117,7 @@ export async function handleEns(
118
117
  };
119
118
  } else {
120
119
  let message = `Looks like ${domain} is already registered!`;
121
- await skill("/cool " + domain);
120
+ await context.executeSkill("/cool " + domain);
122
121
  return {
123
122
  code: 404,
124
123
  message,
@@ -126,7 +126,7 @@ export async function processMultilineResponse(
126
126
  console.log(messages);
127
127
  for (const message of messages) {
128
128
  if (message.startsWith("/")) {
129
- const response = await context.skill(message);
129
+ const response = await context.executeSkill(message);
130
130
  if (response && typeof response.message === "string") {
131
131
  let msg = parseMarkdown(response.message);
132
132
  chatMemory.addEntry(memoryKey, {
@@ -108,8 +108,8 @@ export const getUserInfo = async (
108
108
  }),
109
109
  });
110
110
  const converseData = (await response.json()) as ConverseProfile;
111
- if (process.env.MSG_LOG === "true")
112
- console.log("Converse data", keyToUse, converseData);
111
+ //if (process.env.MSG_LOG === "true")
112
+ //console.log("Converse data", keyToUse, converseData);
113
113
  data.converseUsername =
114
114
  converseData?.formattedName || converseData?.name || undefined;
115
115
  data.address = converseData?.address || undefined;
@@ -1,4 +1,4 @@
1
- import { handleEns } from "./handler/ens.js";
1
+ import { handleEns } from "./handler/ens";
2
2
  import type { SkillGroup } from "@xmtp/message-kit";
3
3
 
4
4
  export const skills: SkillGroup[] = [
@@ -12,7 +12,6 @@ export async function handler(context: HandlerContext) {
12
12
  sender,
13
13
  content: { content, params },
14
14
  },
15
- skill,
16
15
  } = context;
17
16
 
18
17
  const systemPrompt = generateSystemPrompt(context);
@@ -24,7 +23,7 @@ export async function handler(context: HandlerContext) {
24
23
  userPrompt,
25
24
  systemPrompt,
26
25
  );
27
- skill(reply);
26
+ context.executeSkill(reply);
28
27
  } catch (error) {
29
28
  console.error("Error during OpenAI call:", error);
30
29
  await context.reply("An error occurred while processing your request.");
@@ -0,0 +1,24 @@
1
+ import { HandlerContext } from "@xmtp/message-kit";
2
+
3
+ export async function handler(context: HandlerContext) {
4
+ const {
5
+ skills,
6
+ group,
7
+ message: {
8
+ content: { command },
9
+ },
10
+ } = context;
11
+
12
+ if (command == "help") {
13
+ const intro =
14
+ "Available experiences:\n" +
15
+ skills
16
+ ?.flatMap((app) => app.skills)
17
+ .map((skill) => `${skill.command} - ${skill.description}`)
18
+ .join("\n") +
19
+ "\nUse these skills to interact with specific apps.";
20
+ context.send(intro);
21
+ } else if (command == "id") {
22
+ context.send(context.group?.id);
23
+ }
24
+ }
@@ -30,5 +30,5 @@ async function handleReply(context: HandlerContext) {
30
30
  version,
31
31
  v2client.address,
32
32
  );
33
- //await context.skill(chain);
33
+ //await context.executeSkill(chain);
34
34
  }
@@ -126,7 +126,7 @@ export async function processMultilineResponse(
126
126
  console.log(messages);
127
127
  for (const message of messages) {
128
128
  if (message.startsWith("/")) {
129
- const response = await context.skill(message);
129
+ const response = await context.executeSkill(message);
130
130
  if (response && typeof response.message === "string") {
131
131
  let msg = parseMarkdown(response.message);
132
132
  chatMemory.addEntry(memoryKey, {
@@ -108,8 +108,8 @@ export const getUserInfo = async (
108
108
  }),
109
109
  });
110
110
  const converseData = (await response.json()) as ConverseProfile;
111
- if (process.env.MSG_LOG === "true")
112
- console.log("Converse data", keyToUse, converseData);
111
+ /// if (process.env.MSG_LOG === "true")
112
+ //console.log("Converse data", keyToUse, converseData);
113
113
  data.converseUsername =
114
114
  converseData?.formattedName || converseData?.name || undefined;
115
115
  data.address = converseData?.address || undefined;
@@ -3,7 +3,7 @@ import { handler as agent } from "./handler/agent.js";
3
3
  import { handler as transaction } from "./handler/transaction.js";
4
4
  import { handler as games } from "./handler/game.js";
5
5
  import { handler as loyalty } from "./handler/loyalty.js";
6
- import { handler as groupHelp } from "./handler/group.js";
6
+ import { handler as groupHelp } from "./handler/helpers.js";
7
7
  import type { SkillGroup } from "@xmtp/message-kit";
8
8
 
9
9
  export const skills: SkillGroup[] = [