create-message-kit 1.1.7-beta.2 → 1.1.7-beta.5
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 +1 -1
- package/templates/agent/src/handler/ens.ts +1 -2
- package/templates/agent/src/lib/gpt.ts +1 -1
- package/templates/agent/src/lib/resolver.ts +2 -2
- package/templates/agent/src/skills.ts +1 -1
- package/templates/group/src/handler/agent.ts +1 -2
- package/templates/group/src/handler/helpers.ts +24 -0
- package/templates/group/src/index.ts +15 -18
- package/templates/group/src/lib/gpt.ts +1 -1
- package/templates/group/src/lib/resolver.ts +2 -2
- package/templates/group/src/skills.ts +1 -1
package/package.json
CHANGED
@@ -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
|
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.
|
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
|
-
|
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;
|
@@ -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
|
-
|
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
|
+
}
|
@@ -1,23 +1,20 @@
|
|
1
1
|
import { run, HandlerContext } from "@xmtp/message-kit";
|
2
2
|
|
3
3
|
// Main function to run the app
|
4
|
-
run(
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
},
|
19
|
-
{ attachments: true },
|
20
|
-
);
|
4
|
+
run(async (context: HandlerContext) => {
|
5
|
+
const {
|
6
|
+
message: { typeId },
|
7
|
+
group,
|
8
|
+
} = context;
|
9
|
+
switch (typeId) {
|
10
|
+
case "reply":
|
11
|
+
handleReply(context);
|
12
|
+
break;
|
13
|
+
}
|
14
|
+
if (!group) {
|
15
|
+
context.send("This is a group bot, add this address to a group");
|
16
|
+
}
|
17
|
+
});
|
21
18
|
async function handleReply(context: HandlerContext) {
|
22
19
|
const {
|
23
20
|
v2client,
|
@@ -33,5 +30,5 @@ async function handleReply(context: HandlerContext) {
|
|
33
30
|
version,
|
34
31
|
v2client.address,
|
35
32
|
);
|
36
|
-
//await context.
|
33
|
+
//await context.executeSkill(chain);
|
37
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.
|
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
|
-
|
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/
|
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[] = [
|